Skip to content
This repository has been archived by the owner on Oct 26, 2018. It is now read-only.

Commit

Permalink
Fixed production build.
Browse files Browse the repository at this point in the history
Damn you UglifyJS and your wrongly documented mangling options!
  • Loading branch information
mnn committed Sep 22, 2017
1 parent 8ee4b45 commit 20fcdc6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
25 changes: 15 additions & 10 deletions gulpfile.ls
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require! {
fs
del
'js-string-escape'
pump
}
$ = (require \gulp-load-plugins)!
{flatten, map} = require \prelude-ls
Expand Down Expand Up @@ -31,16 +32,20 @@ preludeLs = \prelude-browser-min.js
production = false

gulp.task \scripts, [\styles], ->
gulp.src scriptFiles
.pipe $.replace '%%VERSION%%', packageVersion!
.pipe $.replace '%%COMPILED_CSS%%', readFileAndEscape \basic.css
.pipe $.replace '%%LIB_PRELUDE_LS%%', readFile preludeLs
.pipe $.if !production, $.sourcemaps.init!
.pipe $.livescript {+bare}
.pipe $.if !production, $.sourcemaps.write!
.pipe $.if production, $.uglify {preserveComments: \license, mangle: {except: [\jQuery, \$]} }
.on 'error' -> throw it
.pipe gulp.dest \.
pump([
gulp.src scriptFiles
$.replace '%%VERSION%%', packageVersion!
$.replace '%%COMPILED_CSS%%', readFileAndEscape \basic.css
$.replace '%%LIB_PRELUDE_LS%%', readFile preludeLs
$.if !production, $.sourcemaps.init!
$.livescript {+bare}
$.if !production, $.sourcemaps.write!
$.if production, $.uglify { output: { comments: true }, mangle: { reserved: [\jQuery, \$] } }
gulp.dest \.
],
(err) !-> console.error 'Error: ' + err if err
)


gulp.task \styles, ->
gulp.src styleFiles
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"gulp-util": "^3.0.8",
"js-string-escape": "^1.0.1",
"livescript": "^1.5.0",
"prelude-ls": "^1.1.2"
"prelude-ls": "^1.1.2",
"pump": "^1.0.2"
},
"dependencies": {},
"author": "monnef"
Expand Down

0 comments on commit 20fcdc6

Please sign in to comment.