reorder-attributes
v0.1.1
Published
Re-format attributes in HTML tags to flow in a specific order. If you always prefer `class` before `id` or whatever, this module does that.
Readme
reorder-attributes 
Re-format attributes in HTML tags to flow in a specific order. If you always prefer
classbeforeidor whatever, this module does that.
Install
Install with npm:
npm i reorder-attributes --save-devRun tests
npm testUsage
Pass a string of HTML to reorderAttr():
var reorderAttr = require('strip-attributes');
var str = '<h1 id="a" class="b">Foo</h1>';
// Re-order so `class` is before `id`
reorderAttr(str, ['class']);
//=> '<h1 class="b" id="a">Foo</h1>'Create an array of attributes to order all of your attributes:
var attr = ['id', 'class', 'name', 'href', 'rel', ...];
// only the attributes that actually exist will be re-ordered.
reorderAttr(str, attr);Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on October 16, 2014.
