Skip to content

Docs(EN): Update Preprocessor page to add guidance on SCSS variable sharing. #1487

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions docs/guide/pre-processors.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,36 @@ Note that `sass-loader` processes the non-indent-based `scss` syntax by default.
}
```

### Sharing Variables & Mixins via single import
`sass-resources-loader` in conjunction with `mini-css-extract-plugin` can be used to share variables and mixins across the Vue.js project without having to call an `import` for each component.

```js
// Require MiniCssExtractPlugin
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module: {
rules: [
// CSS & SCSS Processing
{
test: /\.(sa|sc|c)ss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
'sass-loader',
{
loader: 'sass-resources-loader',
options: {
// Load common SCSS [ Vars & Mixins ]
resources: './path/to/shared/variables.scss',
},
}
],
},
]
},
```

## LESS

``` bash
Expand Down