mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
17 lines
410 B
JavaScript
17 lines
410 B
JavaScript
import escapeClassName from './escapeClassName'
|
|
|
|
export default function generateVariantFunction(generator) {
|
|
return (container, config) => {
|
|
const cloned = container.clone()
|
|
|
|
cloned.walkRules(rule => {
|
|
rule.selector = generator({
|
|
className: rule.selector.slice(1),
|
|
separator: escapeClassName(config.options.separator),
|
|
})
|
|
})
|
|
|
|
container.before(cloned.nodes)
|
|
}
|
|
}
|