/posthtml-uglify

A PostHTML plugin to rewrite CSS identifiers in HTML

Primary LanguageJavaScriptISC LicenseISC

posthtml-uglify

Build Status Coverage Status npm version Dependency Status devDependency Status

A PostHTML plugin to rewrite CSS identifiers in HTML for the purposes of compression and obfuscation.

Installation

npm install posthtml-uglify --save

Usage

var posthtml = require('posthtml');
var uglify = require('posthtml-uglify');

posthtml()
  .use(uglify({ whitelist: '.bar' }))
  .process('<style>#foo { color: red } .bar { color: blue }</style><div id="foo" class="bar">baz</div>')
  .then(function(result) {
    console.log(result.html); //=> '<style>#xz { color: red } .bar { color: blue }</style><div id="xz" class="bar">baz</div>'
  });

Contributing

  1. Fork it
  2. Create your feature branch
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Running tests

npm install
npm test