bologer
V2EX  ›  Vue.js

vue 使用 npm 引入 less 的时候 less.modifyVars 不生效是为何?

  •  
  •   bologer · Aug 11, 2020 · 5054 views
    This topic created in 2106 days ago, the information mentioned may be changed or developed.

    在 main.js 中引入 less,然后修改 less 全局变量没有效果,这是为什么呢?

    import less from 'less';
    less.modifyVars({
        '@primary-color': '#000',
        '@success-color': '#5B83AD'
    });
    
    Supplement 1  ·  Aug 12, 2020
    是想实现动态修改全局变量达到切换样式的目的
    4 replies    2020-08-12 09:21:12 +08:00
    cuzfinal
        1
    cuzfinal  
       Aug 11, 2020
    less-loader 4.0 以后就不能这个配置了
    cuzfinal
        2
    cuzfinal  
       Aug 11, 2020
    啊,不是 less-loader 啊,那没事了
    redbuck
        3
    redbuck  
       Aug 11, 2020
    可以用 sass-resources-loader,也支持 less
    bologer
        4
    bologer  
    OP
       Aug 12, 2020
    是想实现动态修改全局变量达到切换样式的目的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5629 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 06:06 · PVG 14:06 · LAX 23:06 · JFK 02:06
    ♥ Do have faith in what you're doing.