8000 docs(css): translate sass related content by QC-L · Pull Request #4396 · vuejs/vue-cli · GitHub
[go: up one dir, main page]

Skip to content

docs(css): translate sass related content #4396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/zh/guide/css.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Vue CLI 项目天生支持 [PostCSS](http://postcss.org/)、[CSS Modules](https:

``` bash
# Sass
npm install -D sass-loader node-sass
npm install -D sass-loader sass

# Less
npm install -D less-loader less
Expand All @@ -29,6 +29,14 @@ $color: red;
</style>
```

::: tip Sass 性能贴士
请注意,当使用 Dart 版本的 Sass 时,默认情况下,**同步编译的速度为异步编译速度的两倍**,这是由于异步回调造成的性能开销。为避免此开销,你可以使用 [fibers](https://www.npmjs.com/package/fibers) 的 package 在异步环境下使用同步的代码。要启用此功能,只需安装 `fibers` 到项目依赖:
```
npm install -D fibers
```
另外请注意,由于这是一个原生模块,因此 OS 与构建环境之间可能存在兼容问题。如果遇到此问题,请执行 `npm uninstall -D fibers` 来解决此问题。
:::

### 自动化导入

如果你想自动化导入文件 (用于颜色、变量、mixin……),你可以使用 [style-resources-loader](https://github.com/yenshih/style-resources-loader)。这里有一个关于 Stylus 的在每个单文件组件和 Stylus 文件中导入 `./src/styles/imports.styl` 的例子:
Expand Down
0