Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Auto-import styles with vue-cli 3
const path = require('path')
module.exports = {
chainWebpack: config => {
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('stylus').oneOf(type)))
},
}
function addStyleResource (rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, './src/styles/imports.styl'),
],
})
}
@Akryum

This comment has been minimized.

Copy link
Owner Author

@Akryum Akryum commented Jul 18, 2018

Installation:

yarn add style-resources-loader -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment