postcss-plugin-namespace
PostCSS Plugin Namespace
PostCSS A PostCSS plugin that could add css selector before all selectors,so that the styles will not affect other projects.
Usage
passed a css selector as the first argument;
postcss([ require('postcss-plugin-namespace')('.insert-selector') ])
input
.foo {
/* Input example */
}
output
.insert-selector .foo {
/* Output example */
}
Options
Pass an options object as the second argument.
options.ignore
Don't prefix specific classes or classes that match a regex.
var css = postcss([namespace('.test', { ignore: [ /body/, ".icon" ] })])
.process(inputCSS)
.then(results => {results.toString()});
See PostCSS docs for examples for your environment.