vue全局使用样式文件--vue-cli-plugin-style-resources-loader
在项目中添加 style-resources-loader
1.安装
vue add style-resources-loader
2.配置
Define your resource's patterns under pluginOptions
> style-resources-loader
在 vue.config.js
.
Name | Data type | Description |
---|---|---|
preProcessor | string | One of: sass, scss, stylus, less |
patterns | string, array | Path to the resources you would like to inject |
patterns
Please read more at patterns.
3.Example
const path = require('path')
module.exports = {
pluginOptions: {
'style-resources-loader': {
'preProcessor': 'stylus',
'patterns': [
path.resolve(__dirname, './src/styles/abstracts/*.styl'),
]
}
}
}