Permalink
Browse files

Beef up index.js, providing access to css_beautify and html_beautify …

…(retaining js_beautify default). refs #2
  • Loading branch information...
1 parent b454da6 commit b9aca4b97c4ef4d749db62468444f4cdd08e8c11 @evocateur committed Mar 18, 2013
Showing with 36 additions and 2 deletions.
  1. +1 −1 cli.js
  2. +35 −1 index.js
View
2 cli.js
@@ -6,7 +6,7 @@ var debug = process.env.DEBUG_JSBEAUTIFY || process.env.JSBEAUTIFY_DEBUG
var fs = require('fs'),
cc = require('config-chain'),
- beautify = require('./beautify').js_beautify,
+ beautify = require('./index'),
nopt = require('nopt'),
path = require('path'),
knownOpts = {
View
@@ -1 +1,35 @@
-module.exports = require('./beautify').js_beautify;
+/**
+The following batches are equivalent:
+
+var beautify_js = require('js-beautify');
+var beautify_js = require('js-beautify').js;
+var beautify_js = require('js-beautify').js_beautify;
+
+var beautify_css = require('js-beautify').css;
+var beautify_css = require('js-beautify').css_beautify;
+
+var beautify_html = require('js-beautify').html;
+var beautify_html = require('js-beautify').html_beautify;
+
+All methods returned accept two arguments, the source string and an options object.
+**/
+var js_beautify = require('./beautify').js_beautify;
+var css_beautify = require('./beautify-css').css_beautify;
+var html_beautify = require('./beautify-html').html_beautify;
+
+// the default is js
+var beautify = function (src, config) {
+ return js_beautify(src, config);
+};
+
+// short aliases
+beautify.js = js_beautify;
+beautify.css = css_beautify;
+beautify.html = html_beautify;
+
+// legacy aliases
+beautify.js_beautify = js_beautify;
+beautify.css_beautify = css_beautify;
+beautify.html_beautify = html_beautify;
+
+module.exports = beautify;

0 comments on commit b9aca4b

Please sign in to comment.