File tree Expand file tree Collapse file tree 3 files changed +25
-14
lines changed Expand file tree Collapse file tree 3 files changed +25
-14
lines changed Original file line number Diff line number Diff line change 1+ module . exports = [
2+ '@import "~bootstrap/scss/_functions.scss"' ,
3+ '@import "~@/assets/scss/vendors/bootstrap-vue/_custom.scss"' ,
4+ '@import "~bootstrap/scss/_variables.scss"' ,
5+ '@import "~bootstrap/scss/_mixins.scss"' ,
6+ '@import "~bootstrap-vue/src/_variables.scss"' ,
7+ ]
Original file line number Diff line number Diff line change 1+ const { merge } = require ( 'lodash/object' )
2+ const bootstrapCssAbstractsImports = require ( './bootstrapCssAbstractsImports' )
3+
14module . exports = ( api , opts ) => {
25 // Resolve asset references from components
36 api . chainWebpack ( config => {
@@ -29,23 +32,17 @@ module.exports = (api, opts) => {
2932 } )
3033 } )
3134
32- //Add bootstrap's variables globally
33- const bootstrapVueVarImports = [
34- '@import "~bootstrap/scss/_functions.scss"' ,
35- '@import "~@/assets/scss/vendors/bootstrap-vue/_custom.scss"' ,
36- '@import "~bootstrap/scss/_variables.scss"' ,
37- '@import "~bootstrap/scss/_mixins.scss"' ,
38- '@import "~bootstrap-vue/src/_variables.scss"' ,
39- ]
40-
41- //add custom variables
42- opts . css . loaderOptions = {
35+ //Add bootstrap's variables/functions/mixins globally
36+ if ( opts . useScss && opts . injectAbstracts ) {
37+ merge ( opts . css , {
38+ loaderOptions :{
4339 sass : {
44- additionalData : bootstrapVueVarImports . join ( '\n' )
40+ additionalData : bootstrapCssAbstractsImports . join ( '\n' )
4541 } ,
4642 scss : {
47- additionalData : [ ...bootstrapVueVarImports , '' ] . join ( ';\n' )
43+ additionalData : [ ...bootstrapCssAbstractsImports , '' ] . join ( ';\n' )
4844 }
4945 }
50-
46+ } )
47+ }
5148}
Original file line number Diff line number Diff line change @@ -10,5 +10,12 @@ module.exports = [
1010 type : 'confirm' ,
1111 default : false ,
1212 message : 'Use scss?'
13+ } ,
14+ {
15+ when : answers => ! ! answers . useScss ,
16+ name : 'injectAbstracts' ,
17+ type : 'confirm' ,
18+ default : false ,
19+ message : 'Would you like to inject vars, functions and mixins in all SFC components?'
1320 }
1421]
You can’t perform that action at this time.
0 commit comments