VUE-CLI2.0 different configuration scenarios build different package distal

Demand: The current set of public application of light, you need to publish to multiple clients, each client but different theme colors;

solution: 

     1, the path sets the theme color points placed below the styles directory

   2, configure the new environment variables: THEME_PATH (name Pickup)

   3, add an alias in webpack.base.conf.js in:

 

   4, using an alias in place to introduce the introduction of main.js

   5, by cross-env plug in the new packaging package.json command, and set the environment variable corresponding to the style file path name portion

 

   This package can be constructed in different scenarios distal different packaging commands!

   This method can respond flexibly to the needs of different set of code to build the front of the package!

tips: do not know there is no method to directly modify the CSS color variables through a configuration file?

 

Guess you like

Origin www.cnblogs.com/sjzbk/p/11347554.html