Skip to content

Commit

Permalink
Fix issue brix#6 (Don't uglify NPM package source files), by skipping…
Browse files Browse the repository at this point in the history
… the minify process for the npm package.
  • Loading branch information
evanvosberg committed Mar 21, 2014
1 parent 32e03fc commit b03d9b0
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

dest: paths.dist + "/crypto-js",
dest_lib: paths.dist + "/crypto-js",
dest_lib_min: paths.dist + "/crypto-js",
dest_lib_min: null,

copy: {
"../package.json": "package.json",
Expand Down Expand Up @@ -157,13 +157,15 @@
.build(function (createdFiles) {

// Minify modules
_.each(createdFiles, function (file) {
var minContent = (uglify)
.minify(pkg.dest_lib + "/" + file)
.code;
if (pkg.dest_lib_min) {
_.each(createdFiles, function (file) {
var minContent = (uglify)
.minify(pkg.dest_lib + "/" + file)
.code;

writeFile(pkg.dest_lib_min + "/" + file, minContent);
});
writeFile(pkg.dest_lib_min + "/" + file, minContent);
});
}

// Copy files
_.each(pkg.copy, function (to, from) {
Expand All @@ -175,6 +177,10 @@
.compress(pkg.dest, pkg.archive, function () {
// Clear package destination directory
fsx.rmrfSync(pkg.dest);
fsx.rmrfSync(pkg.dest_lib);
if (pkg.dest_lib_min) {
fsx.rmrfSync(pkg.dest_lib_min);
}

// Mark package as built
pkg._built = true;
Expand Down

0 comments on commit b03d9b0

Please sign in to comment.