postxml
v0.2.9
Published
Xml transformations
Downloads
29
Readme
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
- postxml-beml - BEML plugin
- postxml-custom-tags
- postxml-image-size - adds sizes to images
- postxml-imgalt
- postxml-import
- postxml-import-styles - replace
<link>
with<style>
and import css-code - postxml-markdown - add classes (bem) to
markdown
html tags - postxml-ng-valid - replace
ng-
withdata-ng
- postxml-placeholder
- postxml-remove - removes elements by query selectors
- postxml-repeat - repeat elements
- postxml-wrap - wrap with emmet abbreviation
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
- http://projects.alanev.ru/wizard/wizard.dev.zip
- http://projects.alanev.ru/apc/apc.dev.zip