Skip to content

Commit

Permalink
Remove workarounds for the uglify task mishandling banners when used …
Browse files Browse the repository at this point in the history
…with source maps. (cherry-picked from d0fadbb)

The issue was fixed in grunt-contrib-uglify:
gruntjs/grunt-contrib-uglify#22
  • Loading branch information
mgol committed Nov 9, 2013
1 parent e815c2c commit 1763b19
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 76 deletions.
39 changes: 10 additions & 29 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function( grunt ) {
var data = {};
try {
data = grunt.file.readJSON( filepath );
} catch(e) {}
} catch ( e ) {}
return data;
}

Expand All @@ -17,8 +17,8 @@ module.exports = function( grunt ) {
delete srcHintOptions.onevar;

grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
dst: readOptionalJSON("dist/.destination.json"),
pkg: grunt.file.readJSON( "package.json" ),
dst: readOptionalJSON( "dist/.destination.json" ),
compare_size: {
files: [ "dist/jquery.js", "dist/jquery.min.js" ],
options: {
Expand Down Expand Up @@ -87,54 +87,35 @@ module.exports = function( grunt ) {
tasks: "build/tasks/*.js"
},
testswarm: {
tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing Sizzle".split(" ")
tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing Sizzle".split( " " )
},
watch: {
files: [ "<%= jshint.grunt.src %>", "<%= jshint.tests.src %>", "src/**/*.js" ],
tasks: "dev"
},
"pre-uglify": {
all: {
files: {
"dist/jquery.pre-min.js": [ "dist/jquery.js" ]
},
options: {
banner: "\n\n\n\n\n\n\n\n\n\n\n\n" + // banner line size must be preserved
"/*! jQuery v<%= pkg.version %> | " +
"(c) 2005, 2013 jQuery Foundation, Inc. | " +
"jquery.org/license */\n"
}
}
},
uglify: {
all: {
files: {
"dist/jquery.min.js": [ "dist/jquery.pre-min.js" ]
"dist/jquery.min.js": [ "dist/jquery.js" ]
},
options: {
// Keep our hard-coded banner
preserveComments: "some",
preserveComments: false,
sourceMap: "dist/jquery.min.map",
sourceMappingURL: "jquery.min.map",
report: "min",
beautify: {
ascii_only: true
},
banner: "/*! jQuery v<%= pkg.version %> | " +
"(c) 2005, 2013 jQuery Foundation, Inc. | " +
"jquery.org/license */",
compress: {
hoist_funs: false,
loops: false,
unused: false
}
}
}
},
"post-uglify": {
all: {
src: [ "dist/jquery.min.map" ],
options: {
tempFiles: [ "dist/jquery.pre-min.js" ]
}
}
}
});

Expand All @@ -148,5 +129,5 @@ module.exports = function( grunt ) {
grunt.registerTask( "dev", [ "build:*:*", "jshint", "jscs" ] );

// Default grunt
grunt.registerTask( "default", [ "jsonlint", "dev", "pre-uglify", "uglify", "post-uglify", "dist:*", "compare_size" ] );
grunt.registerTask( "default", [ "jsonlint", "dev", "uglify", "dist:*", "compare_size" ] );
};
46 changes: 0 additions & 46 deletions build/tasks/uglify.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"grunt": "~0.4.1",
"grunt-compare-size": "~0.4.0",
"grunt-contrib-jshint": "~0.7.0",
"grunt-contrib-uglify": "~0.2.4",
"grunt-contrib-uglify": "~0.2.7",
"grunt-contrib-watch": "~0.5.3",
"grunt-git-authors": "~1.2.0",
"grunt-jscs-checker": "~0.2.3",
Expand Down

0 comments on commit 1763b19

Please sign in to comment.