vue全局使用样式文件vueclipluginstyleresourcesloader

在项目中添加 style-resources-loader 

安装

vue add style-resources-loader

配置

Define your resource's patterns under pluginOptions > style-resources-loader 在 vue.config.js.

NameData typeDescription
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.

Example

const path = require('path')
module.exports = {
  pluginOptions: {
    'style-resources-loader': {
      'preProcessor': 'stylus',
      'patterns': [
        path.resolve(__dirname, './src/styles/abstracts/*.styl'),
      ]
    }
  }
}
 
原文地址:https://www.cnblogs.com/volodya/p/15765579.html