Skip to content

feat: make fibers opt-in for dart sass #3628

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 2 commits into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
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/guide/css.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You can select pre-processors (Sass/Less/Stylus) when creating the project. If y

``` 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 A Tip on Sass Performance
Note that when using Dart Sass, **synchronous compilation is twice as fast as asynchronous compilation** by default, due to the overhead of asynchronous callbacks. To avoid this overhead, you can use the [fibers](https://www.npmjs.com/package/fibers) package to call asynchronous importers from the synchronous code path. To enable this, simply install `fibers` as a project dependency:
```
npm install -D fibers
```
Please also be aware, as it's a native module, there may be compatibility issues vary on the OS and build environment. In that case, please run `npm uninstall -D fibers` to fix the problem.
:::

### Automatic imports

If you want to automatically import files (for colors, variables, mixins...), you can use the [style-resources-loader](https://github.com/yenshih/style-resources-loader). Here is an example for stylus that imports `./src/styles/imports.styl` in every SFC and every stylus files:
Expand Down
1 change: 0 additions & 1 deletion packages/@vue/cli-service/__tests__/generator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ test('dart sass', async () => {

expect(files['src/App.vue']).toMatch('<style lang="scss">')
expect(pkg).toHaveProperty(['devDependencies', 'sass'])
expect(pkg).toHaveProperty(['devDependencies', 'fibers'])
})
1 change: 0 additions & 1 deletion packages/@vue/cli-service/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ module.exports = (api, options) => {
'sass-loader': '^7.1.0'
},
'dart-sass': {
fibers: '^3.1.1',
sass: '^1.17.2',
'sass-loader': '^7.1.0'
},
Expand Down