如何安装svelte_Svelte入门

2023-10-25 08:10
文章标签 安装 入门 svelte

本文主要是介绍如何安装svelte_Svelte入门,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

如何安装svelte

In this article, we are focussed on understanding the basics of Svelte and getting started with this framework. Svelte is a new uprising client side tool which is definitely worth learning. We will guide you through the basic steps required to setup a Svelte Project and display a simple component.

在本文中,我们着重于了解Svelte的基础知识以及该框架的入门。 Svelte是一种新的起义客户端工具 ,绝对值得学习。 我们将指导您完成设置Svelte项目和显示简单组件所需的基本步骤。

Svelte的用途是什么? (What is Svelte used for?)

演示地址

What is Svelte Used for ?
Svelte用于什么用途?

Svelte is a new framework that can be used to create user interface just like other frameworks like React and Vue. The major update in Svelte does most of the code conversion to lower level at compile time itself. Since the work is done majorly during Compile Time, the svelte application would run and bootstrap faster. Svelte is focussed on

Svelte是一个新框架 ,可以像其他框架如React和Vue一样用于创建用户界面。 Svelte中的主要更新本身在编译时会将大部分代码转换为较低级别。 由于工作主要在编译时完成,因此苗条的应用程序将运行并引导得更快。 Card.svelte专注于

  • Application Performance

    应用性能
  • Reactivity to Changes

    对变化的React
  • Light weighted Library

    轻量图书馆
  • Easy of Code and Use

    易于编码和使用

Svelte比React更好吗? (Is Svelte better than React?)

演示地址

Svelte vs React
Card.sveltevs React

React uses concept of “Virtual DOM”. Every time when there are updates to state variable, Virtual DOMs are compared, react keeps the copy of old DOM tree and DOM construct after the update is made. Once the old and new copy of virtual DOM is available, the changes are propagated to the real DOM. The major hurdle over here is that DOM diffing does not comes for free. Although the algorithms to process the DOM diffing is very efficient, still it is an expensive operation to carry out.

React使用“虚拟DOM”的概念。 每当状态变量有更新时,都会对虚拟DOM进行比较,在更新完成后,react会保留旧DOM树和DOM构造的副本。 一旦可以使用旧的和新的虚拟DOM副本,更改就会传播到真实DOM。 此处的主要障碍是DOM差异并非免费提供。 尽管处理DOM扩散的算法非常有效,但执行起来仍然是昂贵的操作。

Svelte vs React, Svelte vs Vue vs React, Is svelte better than react, Svelte Development

Also in case when we are using Hooks, we cannot put down an expensive operation carelessly in the code. If we put down expensive operation inside a React Component using Hooks, it will be recalculated every time when the component is re-rendered.

同样在使用钩子的情况下,我们不能在代码中粗心地放下昂贵的操作。 如果我们使用Hooks在React组件中放下昂贵的操作,则每次重新渲染组件时都会重新计算该操作。

Also in case of React, we have lot of work that is done in the background, in order to manage the component state. We also end up using complex libraries like “redux”, in order to achieve state management.

同样在React的情况下,为了管理组件状态,我们在后台做了很多工作。 我们最终还会使用复杂的库(例如“ redux”)来实现状态管理。

Svelte is capable of achieving all the functionality of React without the use of Virtual DOM. Svelte compiles the code to tiny frame less vanilla JavaScript to make the application fast and performant.

Svelte能够在不使用虚拟DOM的情况下实现React的所有功能。 Svelte将代码编译为无框架的原始JavaScript,以使应用程序快速高效。

在本地安装和运行Svelte项目 (Installing and Running Svelte Project Locally)

演示地址

Setup Svelte Project Locally
在本地设置Svelte项目

We will guide you through the basic setup steps required in order to get up and running with a Svelte Application…

我们将指导您完成所需的基本设置步骤,以启动并运行Svelte应用程序…

1.获取Svelte示例项目 (1. Getting the Svelte Sample Project)

You need to have Node installed in your local system before we can get the basic Svelte project. Then, we can run the following command in the repository where we are required to create a Svelte Application:

您需要先在本地系统中安装Node,然后才能获取基本的Svelte项目。 然后,我们可以在需要创建Svelte应用程序的存储库中运行以下命令:

npx degit sveltejs/template project-name

npx degit sveltejs / template项目名称

2.转到存储库并安装依赖项 (2. Go to the Repository and Install Dependencies)

Once the repository is created, move to the folder and install the dependencies that are required for the project. The dependencies for the project are specified inside the “package.json” file.

创建存储库后,移至该文件夹并安装项目所需的依赖项。 项目的依赖关系在“ package.json”文件中指定。

cd project-name

cd项目名称

Image for post

The dependencies for the Svelte Project is specified inside “devDependencies” and “dependencies”. We need these dependencies to be available before running the application.

Svelte项目的依赖关系在“ devDependencies”和“ dependencies”中指定。 在运行应用程序之前,我们需要这些依赖项可用。

Run the following commands:

运行以下命令:

npm install

npm安装

3.运行“ dev”脚本 (3. Running the “dev” script)

In “package.json”, we have “scripts” defined, in order to run the development environment, we need to run “dev” script.

在“ package.json”中,我们定义了“脚本”,为了运行开发环境,我们需要运行“ dev”脚本。

npm run dev

npm run dev

This command will execute the Svelte project, and we have the application up and running on port 5000 ( http://localhost:5000/ )

此命令将执行Svelte项目,并且我们已在端口5000( http:// localhost:5000 / )上启动并运行该应用程序

Image for post

Summarizing the setup Steps:

总结设置步骤:

Image for post

In case you are thinking to get started with Svelte follow the Webpage:

如果您想开始使用Svelte,请遵循以下网页:

翻译自: https://medium.com/technofunnel/getting-started-with-svelte-18f42a95056c

如何安装svelte


http://www.taodudu.cc/news/show-8061806.html

相关文章:

  • VSFTP入门
  • 常用的短路保护电器有哪些?
  • 安科瑞电气防火限流式保护器在线路发生短路故障发出报警,减少电气火灾事故的发生
  • centos6搭建redis集群搭建(单机多节点)
  • ubuntu 搭建redis集群三节点
  • MyBatis源码解析初步---一个常用的MyBatis的select执行过程的跟踪
  • 【Docker】Docker镜像讲解
  • docker入门(八):docker镜像加载原理
  • 【Docker】学习笔记01:概述、安装、命令
  • 【Docker】学习笔记02:镜像、容器数据卷
  • Docker学习随笔(一)
  • Docker学习笔记---通俗易懂
  • 当下最火的Docker容器(二)《Java-2021面试谈资系列》
  • 【云原生 | Kubernetes 系列】--Gitops持续交付 CD Push Pipeline实现
  • Redis4.0数据库(三):Redis-sentinel哨兵
  • Apache RocketMQ远程代码执行
  • Redis之——集群搭建(基于CentOS6.X单机多节点)
  • iSpy-最好的开源免费视频监控软件
  • 2023华数杯数学建模C题思路代码 母亲身心健康影响
  • 中等数学2015年增刊模拟题(20)——0
  • 微型计算机 增刊 pdf,《中等数学增刊1-2018》小样.pdf
  • 537. 复数乘法(中等 数学 字符串 模拟)
  • 中等数学-2015-2-利用数论知识解数学竞赛题-例1
  • (3n+1)猜想
  • 7-122 3n+1
  • 3n+1问题(循环)
  • c语言中3n+1问题,C语言每日小练(一)——3n+1问题
  • PAT 1005 继续(3n + 1)猜想
  • matlab解数论问题,Matlab数值积分之数论问题3n+1序列
  • FBL3N/FAGLL03自定义字段显示
  • 这篇关于如何安装svelte_Svelte入门的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



    http://www.chinasem.cn/article/281197

    相关文章

    如何在Mac上安装并配置JDK环境变量详细步骤

    《如何在Mac上安装并配置JDK环境变量详细步骤》:本文主要介绍如何在Mac上安装并配置JDK环境变量详细步骤,包括下载JDK、安装JDK、配置环境变量、验证JDK配置以及可选地设置PowerSh... 目录步骤 1:下载JDK步骤 2:安装JDK步骤 3:配置环境变量1. 编辑~/.zshrc(对于zsh

    如何在pycharm安装torch包

    《如何在pycharm安装torch包》:本文主要介绍如何在pycharm安装torch包方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录在pycharm安装torch包适http://www.chinasem.cn配于我电脑的指令为适用的torch包为总结在p

    在PyCharm中安装PyTorch、torchvision和OpenCV详解

    《在PyCharm中安装PyTorch、torchvision和OpenCV详解》:本文主要介绍在PyCharm中安装PyTorch、torchvision和OpenCV方式,具有很好的参考价值,... 目录PyCharm安装PyTorch、torchvision和OpenCV安装python安装PyTor

    Python Transformer 库安装配置及使用方法

    《PythonTransformer库安装配置及使用方法》HuggingFaceTransformers是自然语言处理(NLP)领域最流行的开源库之一,支持基于Transformer架构的预训练模... 目录python 中的 Transformer 库及使用方法一、库的概述二、安装与配置三、基础使用:Pi

    如何解决mmcv无法安装或安装之后报错问题

    《如何解决mmcv无法安装或安装之后报错问题》:本文主要介绍如何解决mmcv无法安装或安装之后报错问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mmcv无法安装或安装之后报错问题1.当我们运行YOwww.chinasem.cnLO时遇到2.找到下图所示这里3.

    Python 安装和配置flask, flask_cors的图文教程

    《Python安装和配置flask,flask_cors的图文教程》:本文主要介绍Python安装和配置flask,flask_cors的图文教程,本文通过图文并茂的形式给大家介绍的非常详细,... 目录一.python安装:二,配置环境变量,三:检查Python安装和环境变量,四:安装flask和flas

    Win11安装PostgreSQL数据库的两种方式详细步骤

    《Win11安装PostgreSQL数据库的两种方式详细步骤》PostgreSQL是备受业界青睐的关系型数据库,尤其是在地理空间和移动领域,:本文主要介绍Win11安装PostgreSQL数据库的... 目录一、exe文件安装 (推荐)下载安装包1. 选择操作系统2. 跳转到EDB(PostgreSQL 的

    Linux系统中卸载与安装JDK的详细教程

    《Linux系统中卸载与安装JDK的详细教程》本文详细介绍了如何在Linux系统中通过Xshell和Xftp工具连接与传输文件,然后进行JDK的安装与卸载,安装步骤包括连接Linux、传输JDK安装包... 目录1、卸载1.1 linux删除自带的JDK1.2 Linux上卸载自己安装的JDK2、安装2.1

    Spring Boot + MyBatis Plus 高效开发实战从入门到进阶优化(推荐)

    《SpringBoot+MyBatisPlus高效开发实战从入门到进阶优化(推荐)》本文将详细介绍SpringBoot+MyBatisPlus的完整开发流程,并深入剖析分页查询、批量操作、动... 目录Spring Boot + MyBATis Plus 高效开发实战:从入门到进阶优化1. MyBatis

    Linux卸载自带jdk并安装新jdk版本的图文教程

    《Linux卸载自带jdk并安装新jdk版本的图文教程》在Linux系统中,有时需要卸载预装的OpenJDK并安装特定版本的JDK,例如JDK1.8,所以本文给大家详细介绍了Linux卸载自带jdk并... 目录Ⅰ、卸载自带jdkⅡ、安装新版jdkⅠ、卸载自带jdk1、输入命令查看旧jdkrpm -qa