vue全局使用样式文件--vue-cli-plugin-style-resources-loader

在项目中添加 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'),
      ]
    }
  }
}
 
posted @ 2022-01-05 09:58  长空雁叫霜晨月  阅读(422)  评论(0编辑  收藏  举报