mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-24 05:50:06 +00:00
perf: remove unused css
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import color from 'css-color-function'
|
||||
import formula from './formula.json'
|
||||
import defaultThemeConfig from './default.js'
|
||||
import variables from '@/styles/var.scss'
|
||||
|
||||
export function generateColors(themeColors) {
|
||||
const colors = {}
|
||||
if (!themeColors) {
|
||||
themeColors = defaultThemeConfig
|
||||
}
|
||||
let primaryColor = themeColors
|
||||
let subColor = defaultThemeConfig
|
||||
if (typeof themeColors === 'object') {
|
||||
primaryColor = themeColors['--color-primary'] || variables.themeColor
|
||||
primaryColor = themeColors['--color-primary']
|
||||
subColor = Object.keys(themeColors).length > 0 ? themeColors : defaultThemeConfig
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { changeMenuColor, generateColors, mix } from './color'
|
||||
import axios from 'axios'
|
||||
import formula from './formula.json'
|
||||
import variables from '@/styles/var.scss'
|
||||
|
||||
let originalStyle = ''
|
||||
|
||||
@@ -64,7 +63,7 @@ export function changeThemeColors(themeColors) {
|
||||
axios.spread((file, extraFile) => {
|
||||
const fileData = file.data
|
||||
const extraFileData = extraFile.data.replace(/[\r\n]/g, '')
|
||||
originalStyle = replaceStyleColors(fileData + extraFileData)
|
||||
originalStyle = replaceStyleColors(fileData + extraFileData, themeColors)
|
||||
resolve()
|
||||
})
|
||||
)
|
||||
@@ -77,8 +76,8 @@ export function changeThemeColors(themeColors) {
|
||||
})
|
||||
}
|
||||
|
||||
export function replaceStyleColors(data) {
|
||||
const colors = generateColors(variables.themeColor)
|
||||
export function replaceStyleColors(data, themeColors) {
|
||||
const colors = generateColors(themeColors['--primary'])
|
||||
const colorMap = new Map()
|
||||
Object.keys(formula).forEach((key) => {
|
||||
colorMap.set(colors[key], key)
|
||||
|
||||
Reference in New Issue
Block a user