PostCSS plugin to add scope to selectors
npm install postcss-simple-scope``css
body {
background: red;
}
.header {
background: black;
}
`
`css
body {
background: red;
}
#scope .header {
background: black;
}
`
`sh`
npm i -D postcss-simple-scope
`js``
// .postcssrs.cjs
module.exports = {
plugins: [
require('postcss-simple-scope')({
scope: '#scope', // required
atRules: {
exclude: ['keyframes', '-webkit-keyframes', '-moz-keyframes'], // default
}, // optional
selectors: {
exclude: [':root', '*', 'html', 'body'], // default
}, // optional
}),
],
};