1 module.exports = function( grunt ) {
5 var gzip = require( "gzip-js" ),
6 readOptionalJSON = function( filepath ) {
9 data = grunt.file.readJSON( filepath );
13 srcHintOptions = readOptionalJSON( "src/.jshintrc" );
15 // The concatenated file won't pass onevar
16 // But our modules can
17 delete srcHintOptions.onevar;
20 pkg: grunt.file.readJSON("package.json"),
21 dst: readOptionalJSON("dist/.destination.json"),
23 files: [ "dist/jquery.js", "dist/jquery.min.js" ],
26 gz: function( contents ) {
27 return gzip.zip( contents, {} ).length;
30 cache: "dist/.sizecache.json"
35 dest: "dist/jquery.js",
40 // Exclude specified modules if the module matching the key is removed
42 ajax: [ "manipulation/_evalUrl" ],
43 callbacks: [ "deferred" ],
44 css: [ "effects", "dimensions", "offset" ],
45 sizzle: [ "css/hidden-visible-selectors", "effects/animated-selector" ]
51 src: [ "package.json" ]
59 src: [ "dist/jquery.js" ],
60 options: srcHintOptions
63 src: [ "Gruntfile.js", "build/tasks/*" ],
69 src: [ "test/**/*.js" ],
71 jshintrc: "test/.jshintrc"
76 tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing Sizzle".split(" ")
79 files: [ "<%= jshint.grunt.src %>", "<%= jshint.tests.src %>", "src/**/*.js" ],
85 "dist/jquery.pre-min.js": [ "dist/jquery.js" ]
88 banner: "\n\n\n\n\n\n\n\n\n\n\n\n" + // banner line size must be preserved
89 "/*! jQuery v<%= pkg.version %> | " +
90 "(c) 2005, 2013 jQuery Foundation, Inc. | " +
91 "jquery.org/license */\n"
98 "dist/jquery.min.js": [ "dist/jquery.pre-min.js" ]
101 // Keep our hard-coded banner
102 preserveComments: "some",
103 sourceMap: "dist/jquery.min.map",
104 sourceMappingURL: "jquery.min.map",
121 "dist/jquery.min.map.tmp": [ "dist/jquery.min.map" ],
122 "dist/jquery.min.js.tmp": [ "dist/jquery.min.js" ]
125 tempFiles: [ "dist/jquery.min.map.tmp", "dist/jquery.min.js.tmp", "dist/jquery.pre-min.js" ]
131 // Load grunt tasks from NPM packages
132 grunt.loadNpmTasks( "grunt-compare-size" );
133 grunt.loadNpmTasks( "grunt-git-authors" );
134 grunt.loadNpmTasks( "grunt-contrib-watch" );
135 grunt.loadNpmTasks( "grunt-contrib-jshint" );
136 grunt.loadNpmTasks( "grunt-contrib-uglify" );
137 grunt.loadNpmTasks( "grunt-jsonlint" );
139 // Integrate jQuery specific tasks
140 grunt.loadTasks( "build/tasks" );
142 // Short list as a high frequency watch task
143 grunt.registerTask( "dev", [ "build:*:*", "jshint" ] );
146 grunt.registerTask( "default", [ "jsonlint", "dev", "pre-uglify", "uglify", "post-uglify", "dist:*", "compare_size" ] );