修复umi-plugin-antd-theme 插件 umi api找不到问题,让其在umi@2.4.4版本中正常工作
umi-plugin-antd-theme的fork版本
Usage
config/theme.config.js
配置
1.优先读取config/theme.config.js
方式可以动态加载模块,方便一些动态处理
Configure in config/theme.config.js
,
const fs = ;const Path = ;const NativeModule = ;const vm = ; const getModuleFromString = { const m = exports: {} ; const wrapper = NativeModule; const script = wrapper filename displayErrors: true ; const result = script; result; return m;}; module { const darkString = fs; const dark = ; return theme: // { key: '官方暗黑', fileName: 'dark.css', theme: 'dark', className: 'theme-dark' }, key: '暗黑主题' fileName: 'custom-dark.css' className: 'theme-custom-dark' modifyVars: darkexports // 是否压缩css min: true // css module isModule: true // 忽略 antd 的依赖 ignoreAntd: false // 忽略 pro-layout ignoreProLayout: false // 不使用缓存 cache: true ;};
plugin option
,参数如下,最后读取config/theme.config.json
2.没有第一步的配置就读取plugin option
的配置会被缓存,无法热更新,所以不推荐,推荐config/theme.config.js
和config/theme.config.json
方式
config/theme.config.json
方式就是静态文件,需要转换文件格式,有点麻烦
Configure in plugin option or config/theme.config.json
,
you can get config in window.umi_plugin_ant_themeVar
LICENSE
MIT