Skip to content

stevenbenisek/posthtml-prefix-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

posthtml-prefix-class

Build Status

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

About

PostHTML plugin to prefix class names

Resources

License

Stars

Watchers

Forks

Packages

No packages published