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-10-16 15:39:44 -04:00
|
|
|
css.walkRules((rule) => {
|
2020-08-14 12:23:28 -04:00
|
|
|
const important = rule.__tailwind ? rule.__tailwind.important : false
|
|
|
|
|
|
|
|
|
|
if (!important) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof important === 'string') {
|
2020-10-16 15:39:44 -04:00
|
|
|
rule.selectors = rule.selectors.map((selector) => {
|
2020-08-14 12:23:28 -04:00
|
|
|
return `${rule.__tailwind.important} ${selector}`
|
|
|
|
|
})
|
|
|
|
|
} else {
|
2020-10-16 15:39:44 -04:00
|
|
|
rule.walkDecls((decl) => (decl.important = true))
|
2020-08-14 12:23:28 -04:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|