-
-
Save basebandit/4a4a62833a1901c83841d497587019f5 to your computer and use it in GitHub Desktop.
build/utils.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.cssLoaders = function(options) { | |
... | |
... | |
function resolveResouce(fileName) { | |
// Absolute Path | |
return path.resolve(__dirname, '../src/assets/scss/' + fileName) | |
} | |
function generateSassResourceLoader() { | |
var loaders = [ | |
cssLoader, | |
'sass-loader', { | |
loader: 'sass-resources-loader', | |
options: { | |
resources: [ | |
resolveResouce('mixins/index.scss'), | |
resolveResouce('vars/index.scss') | |
] | |
} | |
} | |
]; | |
if (options.extract) { | |
return ExtractTextPlugin.extract({ | |
use: loaders, | |
fallback: 'vue-style-loader' | |
}) | |
} else { | |
return ['vue-style-loader'].concat(loaders) | |
} | |
} | |
... | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used it with vuetifyjs/webpack template with a la carte components and works out of the box.No more importing mixins and variables in every scss file that requires them.Thanks to @dc198689