This commit is contained in:
59
unocss.config.ts
Normal file
59
unocss.config.ts
Normal file
@ -0,0 +1,59 @@
|
||||
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants'
|
||||
import { defineConfig, presetUno, presetWind, transformerVariantGroup } from 'unocss';
|
||||
import { classes, globals } from './formkit.config.theme';
|
||||
import { fkLibrary } from './formkit.config.fkLibrary';
|
||||
|
||||
const familyList = [...new Set(Object.values(fkLibrary).map(lib => lib.family))].filter(f => f) as string[]
|
||||
const typeList = [...new Set(Object.values(fkLibrary).map(lib => lib.type))].filter(f => f) as string[]
|
||||
|
||||
console.debug(`familyList :>> `, familyList);
|
||||
console.debug(`typeList :>> `, typeList);
|
||||
|
||||
const globalsR = [...new Set(
|
||||
Object.values(globals).flatMap(v => Object.keys(v))
|
||||
)];
|
||||
const classesR = [...new Set(
|
||||
// Object.values(classes).flatMap(v => Object.keys(v))
|
||||
Object.keys(classes)
|
||||
.filter(k =>
|
||||
familyList.some(f => k.includes(f)) ||
|
||||
typeList.some(t => k.includes(t))
|
||||
)
|
||||
.map(k => classes[k])
|
||||
.flatMap(v => Object.keys(v))
|
||||
.filter(className => !className.includes('[]'))
|
||||
)]
|
||||
// console.debug(`classesR :>> `, classesR);
|
||||
|
||||
|
||||
export default defineConfig({
|
||||
content: {
|
||||
filesystem: [
|
||||
'xx.ts',
|
||||
],
|
||||
inline: [
|
||||
'!border-none', // for: "range__inner"
|
||||
classesR.join(' '),
|
||||
globalsR.join(' '),
|
||||
async () => {
|
||||
return '';
|
||||
},
|
||||
],
|
||||
pipeline: {
|
||||
// include: [
|
||||
// /xx.ts($|\?)/,
|
||||
// ],
|
||||
}
|
||||
},
|
||||
presets: [
|
||||
presetUno({
|
||||
dark: 'media',
|
||||
}),
|
||||
],
|
||||
transformers: [
|
||||
transformerVariantGroup(),
|
||||
],
|
||||
extractors: [
|
||||
extractorArbitraryVariants(),
|
||||
],
|
||||
})
|
Reference in New Issue
Block a user