posthtml-prefix-class
v1.0.5
Published
PostHTML plugin to prefix class names
Downloads
2,561
Maintainers
Readme
posthtml-prefix-class
PostHTML plugin to prefix class names.
Installation
npm install --save-dev posthtml-prefix-class
Usage
var posthtml = require('posthtml');
var posthtmlPrefixClass = require('posthtml-prefix-class');
posthtml()
.use(posthtmlPrefixClass({
prefix: 'prefix-',
ignore: ['selector-2']
}))
.process(
'<div class="selector-1"><div class="selector-2"></div></div>'
)
.then(function (output) {
console.log(output.html);
// <div class="prefix-selector-1"><div class="selector-2"></div></div>
});
Options
prefix
Type: String
Default: ''
The string used to prefix class names.
ignore
Type: Array|String
Default: []
A class name, or an array of class names, to be excluded from prefixing. Accepts any glob expression supported by minimatch.
var posthtml = require('posthtml');
var posthtmlPrefixClass = require('posthtml-prefix-class');
posthtml()
.use(posthtmlPrefixClass({
prefix: 'prefix-',
ignore: ['selector-*']
}))
.process(
'<div class="selector-1"><div class="selector-2"></div></div>'
)
.then(function (output) {
console.log(output.html);
// <div class="selector-1"><div class="selector-2"></div></div>
});
Testing
npm test