tailwindcss/src/lib/applyImportantConfiguration.js

20 lines
506 B
JavaScript
Raw Normal View History

2020-08-14 12:23:28 -04:00
export default function applyImportantConfiguration(_config) {
2020-10-16 13:30:06 -04:00
return function (css) {
2020-08-14 12:23:28 -04:00
css.walkRules(rule => {
const important = rule.__tailwind ? rule.__tailwind.important : false
if (!important) {
return
}
if (typeof important === 'string') {
rule.selectors = rule.selectors.map(selector => {
return `${rule.__tailwind.important} ${selector}`
})
} else {
rule.walkDecls(decl => (decl.important = true))
}
})
}
}