PostHTML plugin to prefix class names.
npm install --save-dev posthtml-prefix-class
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>
});
Type: String
Default: ''
The string used to prefix class names.
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>
});
npm test