Skip to content

Commit ce72120

Browse files
yzStrivehaoqunjiang
authored andcommitted
docs: add less global variables configuration demo (#2343) [ci skip]
1 parent 7bb36ed commit ce72120

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/guide/css.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ module.exports = {
110110

111111
## Passing Options to Pre-Processor Loaders
112112

113-
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:
113+
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:
114114

115115
``` js
116116
// vue.config.js
@@ -122,6 +122,14 @@ module.exports = {
122122
// @/ is an alias to src/
123123
// so this assumes you have a file named `src/variables.scss`
124124
data: `@import "@/variables.scss";`
125+
},
126+
// pass Less.js Options to less-loader
127+
less:{
128+
// http://lesscss.org/usage/#less-options-strict-units `Global Variables`
129+
// `primary` is global variables fields name
130+
globalVars: {
131+
primary: '#fff'
132+
}
125133
}
126134
}
127135
}

0 commit comments

Comments
 (0)