如何安装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

    相关文章

    Pycharm安装报错:Cannot detect a launch configuration解决办法

    《Pycharm安装报错:Cannotdetectalaunchconfiguration解决办法》本文主要介绍了Pycharm安装报错:Cannotdetectalaunchconfigur... 本文主要介绍了Pycharm安装报错:Cannot detect a launch configuratio

    pytorch+torchvision+python版本对应及环境安装

    《pytorch+torchvision+python版本对应及环境安装》本文主要介绍了pytorch+torchvision+python版本对应及环境安装,安装过程中需要注意Numpy版本的降级,... 目录一、版本对应二、安装命令(pip)1. 版本2. 安装全过程3. 命令相关解释参考文章一、版本对

    Windows系统下如何查找JDK的安装路径

    《Windows系统下如何查找JDK的安装路径》:本文主要介绍Windows系统下如何查找JDK的安装路径,文中介绍了三种方法,分别是通过命令行检查、使用verbose选项查找jre目录、以及查看... 目录一、确认是否安装了JDK二、查找路径三、另外一种方式如果很久之前安装了JDK,或者在别人的电脑上,想

    大数据spark3.5安装部署之local模式详解

    《大数据spark3.5安装部署之local模式详解》本文介绍了如何在本地模式下安装和配置Spark,并展示了如何使用SparkShell进行基本的数据处理操作,同时,还介绍了如何通过Spark-su... 目录下载上传解压配置jdk解压配置环境变量启动查看交互操作命令行提交应用spark,一个数据处理框架

    Python FastAPI入门安装使用

    《PythonFastAPI入门安装使用》FastAPI是一个现代、快速的PythonWeb框架,用于构建API,它基于Python3.6+的类型提示特性,使得代码更加简洁且易于绶护,这篇文章主要介... 目录第一节:FastAPI入门一、FastAPI框架介绍什么是ASGI服务(WSGI)二、FastAP

    2025最新版Python3.13.1安装使用指南(超详细)

    《2025最新版Python3.13.1安装使用指南(超详细)》Python编程语言自诞生以来,已经成为全球最受欢迎的编程语言之一,它简单易学易用,以标准库和功能强大且广泛外挂的扩展库,为用户提供包罗... 目录2025最新版python 3.13.1安装使用指南1. 2025年Python语言最新排名2.

    Python依赖库的几种离线安装方法总结

    《Python依赖库的几种离线安装方法总结》:本文主要介绍如何在Python中使用pip工具进行依赖库的安装和管理,包括如何导出和导入依赖包列表、如何下载和安装单个或多个库包及其依赖,以及如何指定... 目录前言一、如何copy一个python环境二、如何下载一个包及其依赖并安装三、如何导出requirem

    Windows环境下安装达梦数据库的完整步骤

    《Windows环境下安装达梦数据库的完整步骤》达梦数据库的安装大致分为Windows和Linux版本,本文将以dm8企业版Windows_64位环境为例,为大家介绍一下达梦数据库的具体安装步骤吧... 目录环境介绍1 下载解压安装包2 根据安装手册安装2.1 选择语言 时区2.2 安装向导2.3 接受协议

    IDEA与JDK、Maven安装配置完整步骤解析

    《IDEA与JDK、Maven安装配置完整步骤解析》:本文主要介绍如何安装和配置IDE(IntelliJIDEA),包括IDE的安装步骤、JDK的下载与配置、Maven的安装与配置,以及如何在I... 目录1. IDE安装步骤2.配置操作步骤3. JDK配置下载JDK配置JDK环境变量4. Maven配置下

    jdk21下载、安装详细教程(Windows、Linux、macOS)

    《jdk21下载、安装详细教程(Windows、Linux、macOS)》本文介绍了OpenJDK21的下载地址和安装步骤,包括Windows、Linux和macOS平台,下载后解压并设置环境变量,最... 目录1、官网2、下载openjdk3、安装4、验证1、官网官网地址:OpenJDK下载地址:Ar