@fishx/fishx-theme-webpack-plugin

1.0.0 • Public • Published

@fishx/fishx-theme-webpack-plugin

This webpack plugin is to generate color specific less/css and inject into your index.html file so that you can change Ant Design specific color theme in browser.

In order to integrate with your webpack configurations, install the package and add following code in your webpack config file.

Install

  • npm install -D @fishx/fishx-theme-webpack-plugin
const AntDesignThemePlugin = require('@fishx/fishx-theme-webpack-plugin');

const options = {
  antDir: path.join(__dirname, './node_modules/antd'),
  stylesDir: path.join(__dirname, './src/styles'),
  varFile: path.join(__dirname, './src/styles/variables.less'),
  mainLessFile: path.join(__dirname, './src/styles/index.less'),
  themeVariables: ['@primary-color'],
  indexFileName: 'index.html',
  generateOnce: false,
  lessUrl: "https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.2/less.min.js",
  publicPath: "",
  customColorRegexArray: [], // An array of regex codes to match your custom color variable values so that code can identify that it's a valid color. Make sure your regex does not adds false positives.
}

const themePlugin = new AntDesignThemePlugin(options);
// in config object
plugins: [
    themePlugin
  ]

Add this plugin in plugins array.

Readme

Keywords

Package Sidebar

Install

npm i @fishx/fishx-theme-webpack-plugin

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

17 kB

Total Files

4

Last publish

Collaborators

  • whalecloud-developer