Permalink
Browse files

Upgrading from 1.0 to 2.0 uglify version

  • Loading branch information...
1 parent 92675d4 commit cfb755d565447fc1af6951f62b2c8ce54265a642 @igorlima igorlima committed Feb 21, 2013
Showing with 19 additions and 16 deletions.
  1. +5 −7 Gruntfile.js
  2. +1 −1 package.json
  3. +7 −4 tasks/minify-lang.js
  4. +6 −4 tasks/minify.js
View
@@ -1,5 +1,4 @@
-var fs = require('fs'),
- uglifyjs = require('uglify-js');
+var fs = require('fs');
module.exports = function (grunt) {
@@ -51,13 +50,12 @@ module.exports = function (grunt) {
files: minifiedFiles
},
options: {
- mangle: {
- toplevel: true
- },
- squeeze: {
+ fromString: true,
+ mangle: true,
+ compress: {
dead_code: false
},
- codegen: {
+ output: {
ascii_only: true
}
}
View
@@ -36,7 +36,7 @@
}
],
"devDependencies" : {
- "uglify-js" : "1.3.4",
+ "uglify-js" : "latest",
"grunt" : "latest",
"grunt-contrib-jshint" : "latest",
"grunt-contrib-nodeunit" : "latest",
View
@@ -34,18 +34,21 @@ module.exports = function (grunt) {
min,
code,
comments,
- tok;
+ tok,
+ result;
// Concat specified files. This should really be a single, pre-built (and
// linted) file, but it supports any number of files.
code = helpers.concat(files, {separator: this.data.separator});
// Add the first comments
- tok = uglifyjs.parser.tokenizer(code);
- min = showCopyright(tok().comments_before);
+ //tok = uglifyjs.parse(code);
+ tok = uglifyjs.parse(code);
+ min = showCopyright(tok.start.comments_before);
// Add the minified source.
- min += uglifyjs(wrapFile(code), grunt.config('uglify'));
+ result = uglifyjs.minify(wrapFile(code), grunt.config('uglify.options'));
+ min += result.code;
grunt.file.write(this.data.dest, min);
// Fail task if errors were logged.
View
@@ -15,18 +15,20 @@ module.exports = function (grunt) {
min,
code,
comments,
- tok;
+ tok,
+ result;
// Concat specified files. This should really be a single, pre-built (and
// linted) file, but it supports any number of files.
code = helpers.concat(files, {separator: this.data.separator});
// Add the first comments
- tok = uglifyjs.parser.tokenizer(code);
- min = showCopyright(tok().comments_before);
+ tok = uglifyjs.parse(code);
+ min = showCopyright(tok.start.comments_before);
// Add the minified source.
- min += uglifyjs(code, grunt.config('uglify'));
+ result = uglifyjs.minify(code, grunt.config('uglify.options'));
+ min += result.code;
grunt.file.write(this.data.dest, min);
// Fail task if errors were logged.

0 comments on commit cfb755d

Please sign in to comment.