PostCSS plugin that allows you to use @apply similar to Tailwind CSS.
npm install --save-dev @syberisle/postcss-at-applyAdd to your plugins list
module.exports = {
plugins: {
"@syberisle/postcss-at-apply": {}
}
}.a { color: red; }
.b { background: blue !important; }
.c { @apply a b; }
.d { @apply !a; }Results:
.a { color: red; }
.b { background: blue !important; }
.c { color: red; background: blue; }
.d { color: red !important; }You can prefix ! to a selector in @apply to have !important added to it, otherwise !important is removed.
You may add !important to the end of @apply, and it will be applied to all rules.