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" + // banner line size must be preserved
89 "/*! jQuery v<%= pkg.version %> | " +
90 "(c) 2005, 2013 jQuery Foundation, Inc. | " +
91 "jquery.org/license\n" +
92 "//@ sourceMappingURL=jquery.min.map\n" +
100 "dist/jquery.min.js": [ "dist/jquery.pre-min.js" ]
103 // Keep our hard-coded banner
104 preserveComments: "some",
105 sourceMap: "dist/jquery.min.map",
106 sourceMappingURL: "jquery.min.map",
123 "dist/jquery.min.map.tmp": [ "dist/jquery.min.map" ],
124 "dist/jquery.min.js.tmp": [ "dist/jquery.min.js" ]
127 tempFiles: [ "dist/jquery.min.map.tmp", "dist/jquery.min.js.tmp", "dist/jquery.pre-min.js" ]
133 // Load grunt tasks from NPM packages
134 grunt.loadNpmTasks( "grunt-compare-size" );
135 grunt.loadNpmTasks( "grunt-git-authors" );
136 grunt.loadNpmTasks( "grunt-contrib-watch" );
137 grunt.loadNpmTasks( "grunt-contrib-jshint" );
138 grunt.loadNpmTasks( "grunt-contrib-uglify" );
139 grunt.loadNpmTasks( "grunt-jsonlint" );
141 // Integrate jQuery specific tasks
142 grunt.loadTasks( "build/tasks" );
144 // Short list as a high frequency watch task
145 grunt.registerTask( "dev", [ "build:*:*", "jshint" ] );
148 grunt.registerTask( "default", [ "jsonlint", "dev", "pre-uglify", "uglify", "post-uglify", "dist:*", "compare_size" ] );