vue-cli3 less全局变量

maiktom 2020-06-08

1. vue add style-resources-loader

2. 

const path = require("path");//这一段需要自行添加
module.exports = {
  pluginOptions: {
    ‘style-resources-loader‘: {
      preProcessor: ‘less‘,
      patterns: [
        path.resolve(__dirname, "src/style/global.less")//需要自行添加
      ]
    }
  }
}

3.

<style lang="less" scoped>
  @import ‘/assets/styles/varibles.less‘;  //全局变量存放的文件(要加~)
</style>

相关推荐

Enjoyendless / 0评论 2020-06-11