Skip to content

Commit 5fefb9d

Browse files
author
Lucas Moreira
committed
Updated documentation regarding Preprocessors
- Added Webpack guide for utilizing centra Variables in SCSS
1 parent 01990d0 commit 5fefb9d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/guide/pre-processors.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,36 @@ Note that `sass-loader` processes the non-indent-based `scss` syntax by default.
9191
}
9292
```
9393

94+
### Sharing Variables & Mixins via single import
95+
`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.
96+
97+
```js
98+
// Require MiniCssExtractPlugin
99+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
100+
101+
module: {
102+
rules: [
103+
// CSS & SCSS Processing
104+
{
105+
test: /\.(sa|sc|c)ss$/,
106+
use: [
107+
MiniCssExtractPlugin.loader,
108+
'css-loader',
109+
'postcss-loader',
110+
'sass-loader',
111+
{
112+
loader: 'sass-resources-loader',
113+
options: {
114+
// Load common SCSS [ Vars & Mixins ]
115+
resources: './path/to/shared/variables.scss',
116+
},
117+
}
118+
],
119+
},
120+
]
121+
},
122+
```
123+
94124
## LESS
95125

96126
``` bash

0 commit comments

Comments
 (0)