diff --git a/tools/build.sh b/tools/build.sh index 444b7569..7b9a5061 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -21,18 +21,9 @@ build_js() # Wrap webkit output into an non-breaking form. # In an upcoming verion these will be replaced with standard webpack umd - cat ./tools/template/beautify.begin.js > ./js/lib/beautify.js - cat ./dist/legacy_beautify_js.js >> ./js/lib/beautify.js - cat ./tools/template/beautify.end.js >> ./js/lib/beautify.js - - cat ./tools/template/beautify-css.begin.js > ./js/lib/beautify-css.js - cat ./dist/legacy_beautify_css.js >> ./js/lib/beautify-css.js - cat ./tools/template/beautify-css.end.js >> ./js/lib/beautify-css.js - - cat ./tools/template/beautify-html.begin.js > ./js/lib/beautify-html.js - cat ./dist/legacy_beautify_html.js >> ./js/lib/beautify-html.js - cat ./tools/template/beautify-html.end.js >> ./js/lib/beautify-html.js - + sed '/GENERATED_BUILD_OUTPUT/ r ./build/legacy/legacy_beautify_js.js' <./tools/template/beautify.wrapper.js >./js/lib/beautify.js || exit 1 + sed '/GENERATED_BUILD_OUTPUT/ r ./build/legacy/legacy_beautify_css.js' <./tools/template/beautify-css.wrapper.js >./js/lib/beautify-css.js || exit 1 + sed '/GENERATED_BUILD_OUTPUT/ r ./build/legacy/legacy_beautify_html.js' <./tools/template/beautify-html.wrapper.js >./js/lib/beautify-html.js || exit 1 } build_beautify() diff --git a/tools/template/beautify-css.end.js b/tools/template/beautify-css.end.js deleted file mode 100644 index 47a6bced..00000000 --- a/tools/template/beautify-css.end.js +++ /dev/null @@ -1,23 +0,0 @@ - -var css_beautify = legacy_beautify_css; -/* Footer */ -if (typeof define === "function" && define.amd) { - // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- ) - define([], function() { - return { - css_beautify: css_beautify - }; - }); -} else if (typeof exports !== "undefined") { - // Add support for CommonJS. Just put this file somewhere on your require.paths - // and you will be able to `var html_beautify = require("beautify").html_beautify`. - exports.css_beautify = css_beautify; -} else if (typeof window !== "undefined") { - // If we're running a web page and don't have either of the above, add our one global - window.css_beautify = css_beautify; -} else if (typeof global !== "undefined") { - // If we don't even have window, try global. - global.css_beautify = css_beautify; -} - -}()); diff --git a/tools/template/beautify-css.begin.js b/tools/template/beautify-css.wrapper.js similarity index 73% rename from tools/template/beautify-css.begin.js rename to tools/template/beautify-css.wrapper.js index ed80c749..f0656a54 100644 --- a/tools/template/beautify-css.begin.js +++ b/tools/template/beautify-css.wrapper.js @@ -63,3 +63,28 @@ // http://www.w3.org/TR/css3-syntax/ (function() { + +/* GENERATED_BUILD_OUTPUT */ + +var css_beautify = legacy_beautify_css; +/* Footer */ +if (typeof define === "function" && define.amd) { + // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- ) + define([], function() { + return { + css_beautify: css_beautify + }; + }); +} else if (typeof exports !== "undefined") { + // Add support for CommonJS. Just put this file somewhere on your require.paths + // and you will be able to `var html_beautify = require("beautify").html_beautify`. + exports.css_beautify = css_beautify; +} else if (typeof window !== "undefined") { + // If we're running a web page and don't have either of the above, add our one global + window.css_beautify = css_beautify; +} else if (typeof global !== "undefined") { + // If we don't even have window, try global. + global.css_beautify = css_beautify; +} + +}()); diff --git a/tools/template/beautify-html.end.js b/tools/template/beautify-html.end.js deleted file mode 100644 index d460fad3..00000000 --- a/tools/template/beautify-html.end.js +++ /dev/null @@ -1,37 +0,0 @@ - -var style_html = legacy_beautify_html; -/* Footer */ -if (typeof define === "function" && define.amd) { - // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- ) - define(["require", "./beautify", "./beautify-css"], function(requireamd) { - var js_beautify = requireamd("./beautify"); - var css_beautify = requireamd("./beautify-css"); - - return { - html_beautify: function(html_source, options) { - return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify); - } - }; - }); -} else if (typeof exports !== "undefined") { - // Add support for CommonJS. Just put this file somewhere on your require.paths - // and you will be able to `var html_beautify = require("beautify").html_beautify`. - var js_beautify = require('./beautify.js'); - var css_beautify = require('./beautify-css.js'); - - exports.html_beautify = function(html_source, options) { - return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify); - }; -} else if (typeof window !== "undefined") { - // If we're running a web page and don't have either of the above, add our one global - window.html_beautify = function(html_source, options) { - return style_html(html_source, options, window.js_beautify, window.css_beautify); - }; -} else if (typeof global !== "undefined") { - // If we don't even have window, try global. - global.html_beautify = function(html_source, options) { - return style_html(html_source, options, global.js_beautify, global.css_beautify); - }; -} - -}()); diff --git a/tools/template/beautify-html.begin.js b/tools/template/beautify-html.wrapper.js similarity index 66% rename from tools/template/beautify-html.begin.js rename to tools/template/beautify-html.wrapper.js index 0cc96065..ecbc9df0 100644 --- a/tools/template/beautify-html.begin.js +++ b/tools/template/beautify-html.wrapper.js @@ -73,3 +73,42 @@ */ (function() { + +/* GENERATED_BUILD_OUTPUT */ + +var style_html = legacy_beautify_html; +/* Footer */ +if (typeof define === "function" && define.amd) { + // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- ) + define(["require", "./beautify", "./beautify-css"], function(requireamd) { + var js_beautify = requireamd("./beautify"); + var css_beautify = requireamd("./beautify-css"); + + return { + html_beautify: function(html_source, options) { + return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify); + } + }; + }); +} else if (typeof exports !== "undefined") { + // Add support for CommonJS. Just put this file somewhere on your require.paths + // and you will be able to `var html_beautify = require("beautify").html_beautify`. + var js_beautify = require('./beautify.js'); + var css_beautify = require('./beautify-css.js'); + + exports.html_beautify = function(html_source, options) { + return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify); + }; +} else if (typeof window !== "undefined") { + // If we're running a web page and don't have either of the above, add our one global + window.html_beautify = function(html_source, options) { + return style_html(html_source, options, window.js_beautify, window.css_beautify); + }; +} else if (typeof global !== "undefined") { + // If we don't even have window, try global. + global.html_beautify = function(html_source, options) { + return style_html(html_source, options, global.js_beautify, global.css_beautify); + }; +} + +}()); diff --git a/tools/template/beautify.end.js b/tools/template/beautify.end.js deleted file mode 100644 index c10c2325..00000000 --- a/tools/template/beautify.end.js +++ /dev/null @@ -1,21 +0,0 @@ - -var js_beautify = legacy_beautify_js; -/* Footer */ -if (typeof define === "function" && define.amd) { - // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- ) - define([], function() { - return { js_beautify: js_beautify }; - }); -} else if (typeof exports !== "undefined") { - // Add support for CommonJS. Just put this file somewhere on your require.paths - // and you will be able to `var js_beautify = require("beautify").js_beautify`. - exports.js_beautify = js_beautify; -} else if (typeof window !== "undefined") { - // If we're running a web page and don't have either of the above, add our one global - window.js_beautify = js_beautify; -} else if (typeof global !== "undefined") { - // If we don't even have window, try global. - global.js_beautify = js_beautify; -} - -}()); diff --git a/tools/template/beautify.begin.js b/tools/template/beautify.wrapper.js similarity index 81% rename from tools/template/beautify.begin.js rename to tools/template/beautify.wrapper.js index 96b9aff0..bf2514e4 100644 --- a/tools/template/beautify.begin.js +++ b/tools/template/beautify.wrapper.js @@ -86,3 +86,27 @@ */ (function() { + +/* GENERATED_BUILD_OUTPUT */ + +var js_beautify = legacy_beautify_js; +/* Footer */ +if (typeof define === "function" && define.amd) { + // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- ) + define([], function() { + return { js_beautify: js_beautify }; + }); +} else if (typeof exports !== "undefined") { + // Add support for CommonJS. Just put this file somewhere on your require.paths + // and you will be able to `var js_beautify = require("beautify").js_beautify`. + exports.js_beautify = js_beautify; +} else if (typeof window !== "undefined") { + // If we're running a web page and don't have either of the above, add our one global + window.js_beautify = js_beautify; +} else if (typeof global !== "undefined") { + // If we don't even have window, try global. + global.js_beautify = js_beautify; +} + +}()); + diff --git a/webpack.config.js b/webpack.config.js index f14332cd..5939af12 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -13,7 +13,7 @@ var legacy = { output: { library: 'legacy_[name]', filename: 'legacy_[name].js', - path: path.resolve(__dirname, 'dist') + path: path.resolve(__dirname, 'build/legacy') } };