vant-ui / vant-demo

Collection of vant demos.
MIT License
1.97k stars 1.19k forks source link

theme写在外部less中不生效 #89

Closed gitdogogo closed 3 years ago

gitdogogo commented 3 years ago

我的vue.config.js

const path = require('path')
const theme = path.resolve(__dirname,'./src/theme/index.less')
console.log(theme)
module.exports = {
  outputDir: 'dist',
  publicPath: process.env.NODE_ENV === 'production' ? '/vant-demo/' : '/',
  css: {
    loaderOptions: {
      less: {
        modifyVars: {
          hack: `true; @import "${theme}";`,
        }
      }
    }
  }
};

src/theme/index.less

@font-size-sm:'13px';
@font-size-md:'15px';
@font-size-lg:'17px';
@goods-action-button-danger-color:'#7232dd';
@goods-action-button-warning-color:'#3eaf7c'; 
gitdogogo commented 3 years ago

升级本地依赖成demo中的版本就可以了