postxml

0.2.9 • Public • Published

Postxml

It is a tool for transforming html/xml with JS plugins based on cheerio.

Instalation

npm i postxml --save-dev

Usage

Nodejs

var postxml = require('postxml');
var cheerioOptions = {};
 
var output = postxml([
      require('postxml-plugin')(pluginOptions)
   ])
   .process('<div class="b-block"></div>', cheerioOptions);
);

Gulp

Use gulp-postxml

var postxml = require('gulp-postxml');
var postxmlPlugins = [
      require('postxml-plugin')(pluginOptions)
   ];
var cheerioOptions = {};
 
gulp.task('html', function () {
   gulp.src('index.htm')
      .pipe(postxml(postxmlPlugins, cheerioOptions))
      .pipe(gulp.dest('out'));
})

API

Process(html, cheerioOptions)

Transform html with plugins

Use(plugin)

Add plugin

Boilerplate for new plugins

Plugins

Ideas for plugins

  • postxml-inline-data - replace images and files with data uri
  • postxml-template - added template for postxml-repeat
  • postxml-lazyload - shortcut syntax for lazyload
  • postxml-prefix - add prefix to all classes
  • postxml-size - shortcut width & height
  • postxml-variables - html variables

Examples of usage postxml in real projects

Readme

Keywords

Package Sidebar

Install

npm i postxml

Weekly Downloads

0

Version

0.2.9

License

MIT

Last publish

Collaborators

  • yepninja