安装 Sass
应用应用 permalink
¥Applications
有很多应用可以让你在几分钟内启动并运行适用于 Mac、Windows 和 Linux 的 Sass。你可以免费下载大多数应用,但其中一些是付费应用<小>(并且完全值得)</小>。
¥There are a good many applications that will get you up and running with Sass in a few minutes for Mac, Windows, and Linux. You can download most of the applications for free but a few of them are paid apps (and totally worth it).
库库 permalink
¥Libraries
Sass 团队为 Sass 维护了两个 Node.js 包,它们都支持 标准 JavaScript API。sass 包 是纯 JavaScript,速度稍慢,但可以安装在 Node.js 支持的所有平台上。sass-embedded 包 在 Dart VM 周围封装了 JS API,因此速度更快,但仅支持 Windows、Mac OS 和 Linux。
¥The Sass team maintains two Node.js packages for Sass, both of which
support the standard JavaScript API. The sass package is pure
JavaScript, which is a little slower but can be installed on all platforms
Node.js supports. The sass-embedded package wraps a JS API around the
Dart VM, so it’s faster but only supports Windows, Mac OS, and Linux.
还有社区维护的以下语言的封装器:
¥There are also community-maintained wrappers for the following languages:
-
Java,包括:
¥Java, including:
-
一个 Gradle 插件。
¥A Gradle plugin.
-
轻量级 封装 Sass CLI 的 Maven 插件。它指定要使用的 Sass 版本。CLI 参数通过
<args>列表传入。¥A lightweight Maven plugin wrapping the Sass CLI. It specifies the Sass version to use. The CLI arguments are passed-in with an
<args>list. -
包含套件的 封装 Dart Sass 的 Maven 插件。它打包了一个固定的
dart-sass版本。CLI 参数作为 Maven 参数公开。¥A batteries-included Maven plugin wrapping Dart Sass. It bundles a fixed
dart-sassversion. The CLI arguments are exposed as Maven parameters.
-
命令行命令行 permalink
¥Command Line
当你在命令行上安装 Sass 时,你将能够运行 sass 可执行文件将 .sass 和 .scss 文件编译为 .css 文件。例如:
¥When you install Sass on the command line, you’ll be able to run the
sass executable to compile .sass and .scss files to .css files.
For example:
sass source/stylesheets/index.scss build/stylesheets/index.css
首先使用以下选项之一安装 Sass,然后运行 sass --version 以确保其安装正确。如果是的话,这将包括 “。你还可以运行 sass --help 以获取有关命令行接口的更多信息。
¥First install Sass using one of the options below, then run
sass --version to be sure it installed correctly. If it did, this will
include “.
You can also run sass --help for more information
about the command-line interface.
一切准备就绪后,就可以去玩了。如果你是 Sass 的新手,我们已经设置了一些资源来帮助你快速学习。
¥Once it’s all set up, go and play. If you’re brand new to Sass we’ve set up some resources to help you learn pretty darn quick.
随处安装(独立)随处安装(独立) permalink
¥Install Anywhere (Standalone)
你可以在 Windows、Mac 或 Linux 上安装 Sass,只需从 GitHub 发布页面 下载适合你操作系统和 CPU 架构的软件包即可。我们为 Windows 提供 ZIP 文件,为 Mac 和 Linux 提供 .tar.gz 文件(tarball 文件)。
¥You can install Sass on Windows, Mac, or Linux by downloading the appropriate
package for your operating system and CPU architecture from the GitHub releases
page. We provide a ZIP file for Windows, and a .tar.gz file (a tarball) for
Mac and Linux.
下载存档后,请将其解压。解压后的文件包含一个名为 dart-sass 的目录,其中包含 sass 可执行脚本(Windows 上为 sass.bat)。没有外部依赖,你无需安装任何其他文件。
¥Once you’ve downloaded the archive, extract it. The extracted files contain a
directory named dart-sass, which contains the sass executable script (or
sass.bat on Windows). There are no external dependencies and nothing else you
need to install.
要在你的计算机上的任何位置运行 Sass,你需要将解压后的 dart-sass 目录添加到系统的 PATH 目录中。有关如何操作的更多信息,请参阅 本指南。
¥To run Sass from anywhere on your machine, you’ll need to add the extracted
dart-sass directory to your system’s PATH. For more information on how to do
that, see this guide.
随处安装 (npm)随处安装 (npm) permalink
¥Install Anywhere (npm)
如果你使用 Node.js,你还可以通过运行以下命令使用 npm 安装 Sass
¥If you use Node.js, you can also install Sass using npm by running
npm install -g sass
但是,请注意,这将安装 Sass 的纯 JavaScript 实现,其运行速度比此处列出的其他选项稍慢。但它具有相同的接口,因此如果你需要更快的速度,以后可以轻松切换到其他实现!
¥However, please note that this will install the pure JavaScript implementation of Sass, which runs somewhat slower than the other options listed here. But it has the same interface, so it’ll be easy to swap in another implementation later if you need a bit more speed!
在 Windows 上安装(Chocolatey)在 Windows 上安装(Chocolatey) permalink
¥Install on Windows (Chocolatey)
如果你使用 Chocolatey 包管理器 for Windows,则可以通过运行来安装 Dart Sass
¥If you use the Chocolatey package manager for Windows, you can install Dart Sass by running
choco install sass
在 Mac OS X 或 Linux(Homebrew)上安装在 Mac OS X 或 Linux(Homebrew)上安装 permalink
¥Install on Mac OS X or Linux (Homebrew)
如果你在 Mac OS X 或 Linux 上使用 Homebrew 包管理器,则可以通过运行来安装 Dart Sass
¥If you use the Homebrew package manager for Mac OS X or Linux, you can install Dart Sass by running
brew install sass/sass/sass