vite-plugin-antd-static-theme
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

vite-plugin-antd-static-theme

根据 umi 插件 umi-plugin-antd-theme 修改的 vite 插件

install

npm i vite-plugin-antd-static-theme -D # yarn add vite-plugin-antd-static-theme -D

demo

//vite.config.ts
import {defineConfig} from 'vite';
import ViteAntdTheme from 'vite-plugin-antd-static-theme';

export default defineConfig(() => ({
  plugins: [viteAntdTheme(options)],
}));
//options
{
  theme: [
    {
      theme: 'dark',
      fileName: 'dark.css',
    },
    {
      fileName: 'mingQing.css',
      modifyVars: {
        '@primary-color': '#13C2C2',
      },
    },
  ],
  // 是否压缩css
  min: true,
  // css module
  isModule: true,
  // 忽略 antd 的依赖
  ignoreAntd: false,
  // 忽略 pro-layout
  ignoreProLayout: false,
  // 不使用缓存
  cache: true,
}

可以通过 window.vite_plugin_ant_themeVar 获取 theme

//获取ts提示
declare interface Window {
  vite_plugin_ant_themeVar: {
    key?: string;
    theme?: string;
    fileName?: string;
    modifyVars?: Record<string, string>;
  }[];
}

点我跳到示例代码

Package Sidebar

Install

npm i vite-plugin-antd-static-theme

Weekly Downloads

5

Version

0.0.2

License

MIT

Unpacked Size

11.1 kB

Total Files

7

Last publish

Collaborators

  • gavant9527