docs: add less global variables configuration demo (#2343) [ci skip]

This commit is contained in:
yzStrive
2018-12-13 21:01:35 +08:00
committed by Haoqun Jiang
parent 7bb36ed972
commit ce72120b10

View File

@@ -110,7 +110,7 @@ module.exports = {
## Passing Options to Pre-Processor Loaders
Sometimes you may want to pass options to the pre-processor's webpack loader. You can do that using the `css.loaderOptions` option in `vue.config.js`. For example, to pass some shared global variables to all your Sass styles:
Sometimes you may want to pass options to the pre-processor's webpack loader. You can do that using the `css.loaderOptions` option in `vue.config.js`. For example, to pass some shared global variables to all your Sass/Less styles:
``` js
// vue.config.js
@@ -122,6 +122,14 @@ module.exports = {
// @/ is an alias to src/
// so this assumes you have a file named `src/variables.scss`
data: `@import "@/variables.scss";`
},
// pass Less.js Options to less-loader
less:{
// http://lesscss.org/usage/#less-options-strict-units `Global Variables`
// `primary` is global variables fields name
globalVars: {
primary: '#fff'
}
}
}
}