Skip to content

Commit d731c37

Browse files
committed
feat: add transition-timing-function as default preserveClassNames
1 parent 160ab3a commit d731c37

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/shared/src/utils.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
import type { IClassGeneratorOptions, IClassGenerator } from './types'
22

3+
export const preserveClassNames = [
4+
// https://tailwindcss.com/docs/transition-timing-function start
5+
// https://github.com/sonofmagic/tailwindcss-mangle/issues/21
6+
'ease-out',
7+
'ease-linear',
8+
'ease-in',
9+
'ease-in-out'
10+
// https://tailwindcss.com/docs/transition-timing-function end
11+
]
12+
13+
// eslint-disable-next-line unicorn/no-array-reduce
14+
const preserveClassNamesMap = preserveClassNames.reduce<Record<(typeof preserveClassNames)[number], true>>((acc, cur) => {
15+
acc[cur] = true
16+
return acc
17+
}, {})
18+
319
export const defaultMangleClassFilter = (className: string) => {
20+
if (preserveClassNamesMap[className]) {
21+
return false
22+
}
423
// ignore className like 'filter','container'
524
// it may be dangerous to mangle/rename all StringLiteral , so use /-/ test for only those with /-/ like:
625
// bg-[#123456] w-1 etc...

0 commit comments

Comments
 (0)