aboutsummaryrefslogtreecommitdiffstats
path: root/grunt.js
diff options
context:
space:
mode:
Diffstat (limited to 'grunt.js')
-rw-r--r--grunt.js121
1 files changed, 26 insertions, 95 deletions
diff --git a/grunt.js b/grunt.js
index 7827961da..ab02e96a4 100644
--- a/grunt.js
+++ b/grunt.js
@@ -1,3 +1,4 @@
+/*jshint node: true */
module.exports = function( grunt ) {
var // modules
@@ -72,6 +73,8 @@ cssFiles.forEach(function( file ) {
grunt.loadNpmTasks( "grunt-css" );
// file size comparison tasks
grunt.loadNpmTasks( "grunt-compare-size" );
+// html validation task
+grunt.loadNpmTasks( "grunt-html" );
grunt.registerHelper( "strip_all_banners", function( filepath ) {
return grunt.file.read( filepath ).replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" );
@@ -137,6 +140,9 @@ grunt.initConfig({
},
min: minify,
cssmin: minifyCSS,
+ htmllint: {
+ all: ["demos/**/*.html", "tests/**/*.html"]
+ },
copy: {
dist: {
src: [
@@ -293,104 +299,29 @@ grunt.initConfig({
}
},
jshint: (function() {
- var defaults = {
- curly: true,
- eqnull: true,
- eqeqeq: true,
- expr: true,
- latedef: true,
- noarg: true,
- onevar: true,
- // TODO: limit to multi-line comments https://github.com/jshint/jshint/issues/503
- smarttabs: true,
- // TODO: use "faux strict mode" https://github.com/jshint/jshint/issues/504
- // strict: true,
- trailing: true,
- undef: true
- };
+ function parserc( path ) {
+ var rc = grunt.file.readJSON( (path || "") + ".jshintrc" ),
+ settings = {
+ options: rc,
+ globals: {}
+ };
+
+ (rc.predef || []).forEach(function( prop ) {
+ settings.globals[ prop ] = true;
+ });
+ delete rc.predef;
- function extend( a, b ) {
- for ( var prop in b ) {
- a[ prop ] = b[ prop ];
- }
- return a;
+ return settings;
}
return {
- options: defaults,
- grunt: {
- options: extend({
- node: true
- }, defaults ),
- globals: {
- task: true,
- config: true,
- file: true,
- log: true,
- template: true
- }
- },
- ui: {
- options: extend({
- browser: true,
- jquery: true
- }, defaults ),
- globals: {
- Globalize: true
- }
- },
- tests: {
- options: extend({
- browser: true,
- jquery: true,
- // TODO: this is only for document.write() https://github.com/jshint/jshint/issues/519
- evil: true
- }, defaults ),
- // TODO: don't create so many globals in tests
- globals: {
- addMonths: true,
- asyncTest: true,
- container: true,
- deepEqual: true,
- d1: true,
- d2: true,
- dlg: true,
- domEqual: true,
- drag: true,
- dragged: true,
- el: true,
- equal: true,
- equalsDate: true,
- expect: true,
- Globalize: true,
- heightAfter: true,
- init: true,
- isNotOpen: true,
- isOpen: true,
- modal: true,
- module: true,
- moved: true,
- notEqual: true,
- offsetAfter: true,
- offsetBefore: true,
- ok: true,
- PROP_NAME: true,
- QUnit: true,
- restoreScroll: true,
- shouldBeDroppable: true,
- shouldmove: true,
- shouldNotBeDroppable: true,
- shouldnotmove: true,
- shouldnotresize: true,
- shouldresize: true,
- start: true,
- strictEqual: true,
- stop: true,
- test: true,
- TestHelpers: true,
- widthAfter: true
- }
- }
+ // TODO: use "faux strict mode" https://github.com/jshint/jshint/issues/504
+ // TODO: limit `smarttabs` to multi-line comments https://github.com/jshint/jshint/issues/503
+ options: parserc(),
+ ui: parserc( "ui/" ),
+ // TODO: `evil: true` is only for document.write() https://github.com/jshint/jshint/issues/519
+ // TODO: don't create so many globals in tests
+ tests: parserc( "tests/" )
};
})()
});
@@ -578,7 +509,7 @@ grunt.registerTask( "clean", function() {
require( "rimraf" ).sync( "dist" );
});
-grunt.registerTask( "default", "lint csslint qunit build compare_size" );
+grunt.registerTask( "default", "lint csslint htmllint qunit build compare_size" );
grunt.registerTask( "sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" );
grunt.registerTask( "build", "concat min cssmin" );
grunt.registerTask( "release", "clean build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" );