Skip to content

Commit

Permalink
Support being loaded as a Node.js module.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariya Hidayat committed Sep 6, 2012
1 parent c6d837c commit 5dfc9fd
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions cssbeautify.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Copyright (C) 2012 Sencha Inc.
Copyright (C) 2011 Sencha Inc.
Author: Ariya Hidayat.
Expand All @@ -22,10 +23,11 @@
THE SOFTWARE.
*/

/*jslint continue: true, indent: 4 */
/*jslint continue: true, indent: 4, node: true, browser: true */

function cssbeautify(style, opt) {
'use strict';
(function() {

function cssbeautify(style, opt) {

var options, index = 0, length = style.length, blocks, formatted = '',
ch, ch2, str, state, State, depth, quote, comment,
Expand Down Expand Up @@ -413,4 +415,14 @@ function cssbeautify(style, opt) {
formatted = blocks.join('') + formatted;

return formatted;
}
};

if (typeof exports !== 'undefined') {
// Node.js module.
module.exports = exports = cssbeautify;
} else if (typeof window === 'object') {
// Browser loading.
window.cssbeautify = cssbeautify;
}

})();

0 comments on commit 5dfc9fd

Please sign in to comment.