@@ -21,6 +21,10 @@ function createBanner( files ) {
2121 " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */" ;
2222}
2323
24+ // a working grunt.loadNpmTasks replacement
25+ // gets us csslint and cssmin tasks
26+ require ( 'grunt-css' ) ( grunt ) ;
27+
2428// allow access from banner template
2529global . stripDirectory = stripDirectory ;
2630grunt . registerHelper ( "strip_all_banners" , function ( filepath ) {
@@ -91,7 +95,7 @@ grunt.initConfig({
9195 }
9296 } ,
9397 min : minify ,
94- css_min : minifyCSS ,
98+ cssmin : minifyCSS ,
9599 copy : {
96100 dist : {
97101 src : [
@@ -351,46 +355,6 @@ grunt.registerMultiTask( "zip", "Create a zip file for release", function() {
351355 } ) ;
352356} ) ;
353357
354- grunt . registerMultiTask ( "csslint" , "Lint CSS files with csslint" , function ( ) {
355- var csslint = require ( "csslint" ) . CSSLint ;
356- var files = grunt . file . expandFiles ( this . file . src ) ;
357- var ruleset = { } ;
358- csslint . getRules ( ) . forEach ( function ( rule ) {
359- ruleset [ rule . id ] = 1 ;
360- } ) ;
361- for ( var rule in this . data . rules ) {
362- if ( ! this . data . rules [ rule ] ) {
363- delete ruleset [ rule ] ;
364- } else {
365- ruleset [ rule ] = this . data . rules [ rule ] ;
366- }
367- }
368- var hadErrors = 0 ;
369- files . forEach ( function ( filepath ) {
370- grunt . log . writeln ( "Linting " + filepath ) ;
371- var result = csslint . verify ( grunt . file . read ( filepath ) , ruleset ) ;
372- result . messages . forEach ( function ( message ) {
373- grunt . log . writeln ( "[" . red + ( "L" + message . line ) . yellow + ":" . red + ( "C" + message . col ) . yellow + "]" . red ) ;
374- log [ message . type === "error" ? "error" : "writeln" ] ( message . message + " " + message . rule . desc + " (" + message . rule . id + ")" ) ;
375- } ) ;
376- if ( result . messages . length ) {
377- hadErrors += 1 ;
378- }
379- } ) ;
380- if ( hadErrors ) {
381- return false ;
382- }
383- grunt . log . writeln ( "Lint free" ) ;
384- } ) ;
385-
386- grunt . registerMultiTask ( "css_min" , "Minify CSS files with Sqwish." , function ( ) {
387- var max = grunt . helper ( "concat" , grunt . file . expandFiles ( this . file . src ) ) ;
388- var min = require ( "sqwish" ) . minify ( max , false ) ;
389- grunt . file . write ( this . file . dest , min ) ;
390- grunt . log . writeln ( "File '" + this . file . dest + "' created." ) ;
391- grunt . helper ( "min_max_info" , min , max ) ;
392- } ) ;
393-
394358grunt . registerMultiTask ( "md5" , "Create list of md5 hashes for CDN uploads" , function ( ) {
395359 // remove dest file before creating it, to make sure itself is not included
396360 if ( require ( "path" ) . existsSync ( this . file . dest ) ) {
@@ -542,7 +506,7 @@ grunt.registerHelper( "lpad", function( str, len, chr ) {
542506
543507grunt . registerTask ( "default" , "lint csslint qunit build compare_size" ) ;
544508grunt . registerTask ( "sizer" , "concat:ui min:dist/jquery-ui.min.js compare_size" ) ;
545- grunt . registerTask ( "build" , "concat min css_min " ) ;
509+ grunt . registerTask ( "build" , "concat min cssmin " ) ;
546510grunt . registerTask ( "release" , "clean build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" ) ;
547511grunt . registerTask ( "release_themes" , "release download_themes copy_themes copy:themes md5:themes zip:themes" ) ;
548512grunt . registerTask ( "release_cdn" , "release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn" ) ;
0 commit comments