安装 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-sass
version. 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.
随处安装(独立)
¥Install Anywhere (Standalone)
你可以通过下载适用于你的操作系统 从 GitHub 和 将其添加到你的 PATH
的软件包来在 Windows、Mac 或 Linux 上安装 Sass。仅此而已 - 没有外部依赖,也不需要安装其他任何东西。
¥You can install Sass on Windows, Mac, or Linux by downloading the package for
your operating system from
GitHub and adding it to
your PATH
. That’s all—there are no
external dependencies and nothing else you need to install.
随处安装 (npm)
¥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
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)
¥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)上安装
¥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