A PostCSS plugin used to wrap css styles with a css selector used to constrain their affect on parent elements in a page for use when embedding an html interface inside an application container you do not control.
Dependencies
Contributors
Getting Started
0. Ensure all Dependencies have been resolved.
1. Install the Node module:
npm install postcss-prefixwrap
2. Load the module in your build configuration:
var prefixwrap = require("postcss-prefixwrap");
3. Instantiate the PostCSS plugin:
var wrapSelector = ".my-custom-wrap";
{
postcss: [
prefixwrap(wrapSelector)
]
}
4. Add the container to your markup:
<div class="my-custom-wrap">
</div>
5. Your css will now be contained:
p {
color: red;
}
body {
font-size: 16px;
}
.my-custom-wrap p {
color: red;
}
.my-custom-wrap {
font-size: 16px;
}
Testing
See https://travis-ci.org/dbtedman/postcss-prefixwrap for CI results, run on each commit.
Static Analysis
Code is linted using ESLint:
npm run test:lint