0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-18 10:52:19 +01:00

Customizer: switch to UglifyJS2 (v2.4.13).

The uglify build is generated with `uglifyjs --self -o uglify.min.js`.
This commit is contained in:
XhmikosR 2014-03-28 20:05:59 +02:00
parent ee2df11e93
commit 3f90763995
2 changed files with 24 additions and 16 deletions

View File

@ -276,7 +276,24 @@ window.onload = function () { // wait for load in a dumb way because B-0
return result
}
function generateJavascript(preamble) {
function uglify(js) {
var ast = UglifyJS.parse(js)
ast.figure_out_scope()
var compressor = UglifyJS.Compressor()
var compressedAst = ast.transform(compressor)
compressedAst.figure_out_scope()
compressedAst.compute_char_frequency()
compressedAst.mangle_names()
var stream = UglifyJS.OutputStream()
compressedAst.print(stream)
return stream.toString()
}
function generateJS(preamble) {
var $checked = $('#plugin-section input:checked')
if (!$checked.length) return false
@ -351,7 +368,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
' * Config saved to config.json and ' + gistUrl + '\n' +
' */\n'
generateZip(generateCSS(preamble), generateJavascript(preamble), generateFonts(), configJson, function (blob) {
generateZip(generateCSS(preamble), generateJS(preamble), generateFonts(), configJson, function (blob) {
$compileBtn.removeAttr('disabled')
saveAs(blob, 'bootstrap.zip')
})

File diff suppressed because one or more lines are too long