Silvestr-b / postcss-replace-bemclasses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PostCSS Replace BEMClasses Build Status

PostCSS This plugin replace CSS classes by JSON like: { "className": "newName" }

From:

.button {
    background: #0099cc; 
}
.button .icon {
	margin: 4px;
}

With:

// path/to/file.json
{
	"button": "btn",
	"icon": "_j2s"
}

To:

.btn {
    background: #0099cc; 
}
.btn ._j2s {
	margin 4px;
}

Usage

const options = {
	file: 'path/to/file.json' 
}

postcss([ require('postcss-replace-bemclasses')(options) ])

See PostCSS docs for examples for your environment.

About

License:MIT License


Languages

Language:JavaScript 100.0%