mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Add atRule helper for plugins
This commit is contained in:
parent
24d184fbfc
commit
a6342e60ce
@ -19,6 +19,17 @@ function defineRule(selector, properties) {
|
||||
return postcss.rule({ selector }).append(decls)
|
||||
}
|
||||
|
||||
function defineAtRule(atRule, rules) {
|
||||
const [name, ...params] = atRule.split(' ')
|
||||
|
||||
return postcss
|
||||
.atRule({
|
||||
name: name.startsWith('@') ? name.slice(1) : name,
|
||||
params: params.join(' '),
|
||||
})
|
||||
.append(rules)
|
||||
}
|
||||
|
||||
function processPlugins(config) {
|
||||
const pluginComponents = []
|
||||
const pluginUtilities = []
|
||||
@ -27,6 +38,7 @@ function processPlugins(config) {
|
||||
plugin({
|
||||
config,
|
||||
rule: defineRule,
|
||||
atRule: defineAtRule,
|
||||
e: escapeClassName,
|
||||
addUtilities: (utilities, variants) => {
|
||||
pluginUtilities.push(wrapWithVariants(utilities, variants))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user