postcss-ns
v0.0.3
Published
Simple namespaces for postcss
Downloads
3
Readme
PostCSS Namespaces
Install
npm i --save postcss-ns
- add into your
postcss.config.js
:
module.exports =
{
plugins:
[
require('./postcss-ns/postcss-ns')(), // this line
]
};
Using
Describe your namespace:
ns:my-prefix {
/* css */
}
Use it
ns:my-prefix
{
.ns-suffix { color: red; }
#ns-suffix { color: red; }
.ns-s1 .ns-s2,
.ns-s3.ns-s4
{ color: red; }
}
result:
.my-prefix-suffix { color: red; }
#my-prefix-suffix { color: red; }
.my-prefix-s1 .my-prefix-s2,
.my-prefix-s3.my-prefix-s4
{ color: red; }
Notes
- You can use
[\d\w-:_]+
as namespace name - You can use
.ns-
,#ns-
,.ns_
,#ns_
,#ns
,.ns
in selectors
How it works
String replace & regular expressions :)