1,安装style-resources-loader:vue add style-resources-loader;

2,在vue.config.js中的pluginOptions添加第三方插件:

  a,引入路径:const path = require('path');
  b,配置:
    pluginOptions: {
        'style-resources-loader': {
            preProcessor: 'less',
            patterns: [
              path.resolve(__dirname, './src/assets/custom.less')
            ]
          }
    },
3,在定义的less文件上部声明文件采用 UTF-8 编码:
  @charset "UTF-8";
posted on 2019-10-21 11:43  wxx17513  阅读(676)  评论(0编辑  收藏  举报