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

    相关文章

    Python UV安装、升级、卸载详细步骤记录

    《PythonUV安装、升级、卸载详细步骤记录》:本文主要介绍PythonUV安装、升级、卸载的详细步骤,uv是Astral推出的下一代Python包与项目管理器,主打单一可执行文件、极致性能... 目录安装检查升级设置自动补全卸载UV 命令总结 官方文档详见:https://docs.astral.sh/

    Nexus安装和启动的实现教程

    《Nexus安装和启动的实现教程》:本文主要介绍Nexus安装和启动的实现教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、Nexus下载二、Nexus安装和启动三、关闭Nexus总结一、Nexus下载官方下载链接:DownloadWindows系统根

    Java SWT库详解与安装指南(最新推荐)

    《JavaSWT库详解与安装指南(最新推荐)》:本文主要介绍JavaSWT库详解与安装指南,在本章中,我们介绍了如何下载、安装SWTJAR包,并详述了在Eclipse以及命令行环境中配置Java... 目录1. Java SWT类库概述2. SWT与AWT和Swing的区别2.1 历史背景与设计理念2.1.

    安装centos8设置基础软件仓库时出错的解决方案

    《安装centos8设置基础软件仓库时出错的解决方案》:本文主要介绍安装centos8设置基础软件仓库时出错的解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录安装Centos8设置基础软件仓库时出错版本 8版本 8.2.200android4版本 javas

    Pytorch介绍与安装过程

    《Pytorch介绍与安装过程》PyTorch因其直观的设计、卓越的灵活性以及强大的动态计算图功能,迅速在学术界和工业界获得了广泛认可,成为当前深度学习研究和开发的主流工具之一,本文给大家介绍Pyto... 目录1、Pytorch介绍1.1、核心理念1.2、核心组件与功能1.3、适用场景与优势总结1.4、优

    conda安装GPU版pytorch默认却是cpu版本

    《conda安装GPU版pytorch默认却是cpu版本》本文主要介绍了遇到Conda安装PyTorchGPU版本却默认安装CPU的问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的... 目录一、问题描述二、网上解决方案罗列【此节为反面方案罗列!!!】三、发现的根本原因[独家]3.1 p

    Python中OpenCV与Matplotlib的图像操作入门指南

    《Python中OpenCV与Matplotlib的图像操作入门指南》:本文主要介绍Python中OpenCV与Matplotlib的图像操作指南,本文通过实例代码给大家介绍的非常详细,对大家的学... 目录一、环境准备二、图像的基本操作1. 图像读取、显示与保存 使用OpenCV操作2. 像素级操作3.

    windows系统上如何进行maven安装和配置方式

    《windows系统上如何进行maven安装和配置方式》:本文主要介绍windows系统上如何进行maven安装和配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不... 目录1. Maven 简介2. maven的下载与安装2.1 下载 Maven2.2 Maven安装2.

    Redis指南及6.2.x版本安装过程

    《Redis指南及6.2.x版本安装过程》Redis是完全开源免费的,遵守BSD协议,是一个高性能(NOSQL)的key-value数据库,Redis是一个开源的使用ANSIC语言编写、支持网络、... 目录概述Redis特点Redis应用场景缓存缓存分布式会话分布式锁社交网络最新列表Redis各版本介绍旧

    Linux下安装Anaconda3全过程

    《Linux下安装Anaconda3全过程》:本文主要介绍Linux下安装Anaconda3全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录简介环境下载安装一、找到下载好的文件名为Anaconda3-2018.12-linux-x86_64的安装包二、或者通