JSPM

  • Created
  • Published
  • Downloads 907949
  • Score
    100M100P100Q190464F
  • License MIT

HTML post processor

Package Exports

  • posthtml

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (posthtml) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

PostHTML

npm version Build Status Coverage Status

PostHTML is a tool for transforming HTML with JS plugins. PostHTML itself is very small. It includes only a HTML parser, a HTML node tree API and a node tree stringifier.

All HTML transformations are made by plugins. And these plugins are just small plain JS functions, which receive a HTML node tree, transform it, and return a modified tree.

Usage

var posthtml = require('posthtml'),
    fs = require('fs');

var html = '<div class="wow">OMG</div>';

posthtml([ require('posthtml-to-svg-tags')(), require('posthtml-extend-attrs')() ])
    .process(html)
    .then(function(result) {
        fs.writeFileSync('index.html', result);
    });

Plugins