-
-
Save dobbbri/10256f5319c0841e6797546f28437598 to your computer and use it in GitHub Desktop.
Auto-import styles with vue-cli 3
This file contains hidden or 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
const path = require('path') | |
module.exports = { | |
chainWebpack: config => { | |
addStyleResource(config.module.rule('stylus').oneOf('vue-modules')) | |
addStyleResource(config.module.rule('stylus').oneOf('vue')) | |
addStyleResource(config.module.rule('stylus').oneOf('normal-modules')) | |
addStyleResource(config.module.rule('stylus').oneOf('normal')) | |
}, | |
} | |
function addStyleResource (rule) { | |
rule.use('style-resource') | |
.loader('style-resources-loader') | |
.options({ | |
patterns: [ | |
path.resolve(__dirname, './src/styles/imports.styl'), | |
], | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment