0.7.1 • Published 4 months ago

webpack-theme-set v0.7.1

Weekly downloads
50
License
-
Repository
-
Last release
4 months ago

set-webpack-theme

配合webpack-css-themes-plugin使用,用于加载其生成的主题

Demo

import themeSetter from 'webpack-theme-set'
// 按照 window._pageThemeConfig -> urlQuery -> cookie的次序设置主题信息
themeSetter.autoSetTheme()
// 切换主题
themeSetter.setTheme('default', {
  count: 3,
  prefix: 'app-'
})

注意:设置主题后,iframe等必须刷新页面,请主动执行

主题文件

主题文件名规则如下 1. themeFileCount = 1 时候,单主题文件,为${prefix}${themeName}.css 2. themeFileCount > 1 时候, 多主体文件,为${prefix}${themeName}-${index}.css

API

constructor

初始化类的时候,按照window._pageThemeConfig -> urlQuery -> cookie的优先级获取主题信息,一旦从某个来源中获取到主题信息便会返回并设置当前主题

如果都没有获取则不会设置主题

SetTheme

setTheme(themeName: string, { count, prefix, }?: { count?: number; prefix?: string; }): void

  • themeName: 主题名称
  • count: 主题文件数量,由于IE9兼容,可能拆分成N份,默认为1
  • prefix: 主题文件前缀,默认为app-
0.7.1

4 months ago

0.7.0

5 months ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.0

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.0

4 years ago

0.3.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago