Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/157315

Change subject: build: Use cssmin after cssjanus rather than before to fix RTL
......................................................................

build: Use cssmin after cssjanus rather than before to fix RTL

Also take the opportunity to clean up the different modules and label each
section of the Gruntfile.js with what they do.

Change-Id: Ic8f8194141d644804d3378556ea126ba8597584c
---
M Gruntfile.js
M package.json
2 files changed, 37 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/15/157315/1

diff --git a/Gruntfile.js b/Gruntfile.js
index f7a1e86..3044787 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -8,6 +8,7 @@
        grunt.loadNpmTasks( 'grunt-contrib-clean' );
        grunt.loadNpmTasks( 'grunt-contrib-concat-sourcemaps' );
        grunt.loadNpmTasks( 'grunt-contrib-csslint' );
+       grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
        grunt.loadNpmTasks( 'grunt-contrib-jshint' );
        grunt.loadNpmTasks( 'grunt-contrib-less' );
        grunt.loadNpmTasks( 'grunt-contrib-qunit' );
@@ -49,6 +50,8 @@
 
        grunt.initConfig( {
                pkg: grunt.file.readJSON( 'package.json' ),
+
+               // Build
                clean: {
                        dist: 'dist/*'
                },
@@ -58,12 +61,23 @@
                        apex: lessFiles['dist/oojs-ui-apex.css'],
                        minerva: lessFiles['dist/oojs-ui-minerva.css']
                },
+
+               // Build – JS
+               concat: {
+                       options: {
+                               banner: grunt.file.read( 'build/banner.txt' )
+                       },
+                       js: {
+                               dest: 'dist/oojs-ui.js',
+                               src: modules['oojs-ui'].scripts
+                       }
+               },
+
+               // Build – LESS/CSS
                less: {
                        dist: {
                                options: {
-                                       ieCompat: true,
-                                       cleancss: true,
-                                       report: 'gzip'
+                                       ieCompat: true
                                },
                                files: lessFiles
                        }
@@ -73,16 +87,14 @@
                                files: rtlFiles
                        }
                },
-               concat: {
+               cssmin: {
                        options: {
-                               banner: grunt.file.read( 'build/banner.txt' )
+                               banner: grunt.file.read( 'build/banner.txt' ),
+                               compatibility: 'ie8',
+                               report: 'gzip'
                        },
-                       css: {
-                               files: concatCssFiles
-                       },
-                       js: {
-                               dest: 'dist/oojs-ui.js',
-                               src: modules['oojs-ui'].scripts
+                       input: {
+                               files: [ concatCssFiles, rtlFiles ]
                        }
                },
                copy: {
@@ -101,6 +113,8 @@
                                dest: 'dist'
                        }
                },
+
+               // Lint – JS
                jshint: {
                        options: {
                                jshintrc: true
@@ -114,6 +128,8 @@
                                '!demos/{dist,lib}/**'
                        ]
                },
+
+               // Lint – CSS/LESS
                csslint: {
                        options: {
                                csslintrc: '.csslintrc'
@@ -123,12 +139,18 @@
                                '!demos/{dist,lib}/**'
                        ]
                },
+
+               // Lint – i18n
                banana: {
                        all: 'i18n/'
                },
+
+               // Test
                qunit: {
                        all: 'tests/index.html'
                },
+
+               // Development
                watch: {
                        files: [
                                '<%= jshint.dev %>',
@@ -163,7 +185,9 @@
                } );
        } );
 
-       grunt.registerTask( 'build', [ 'clean', 'fileExists', 'less', 'concat', 
'cssjanus', 'copy' ] );
+       grunt.registerTask( 'build', [ 'clean', 'fileExists', 'build-js', 
'build-css' ] );
+       grunt.registerTask( 'build-js', [ 'concat' ] );
+       grunt.registerTask( 'build-css', [ 'less', 'cssjanus', 'cssmin', 'copy' 
] );
        grunt.registerTask( 'git-build', [ 'pre-git-build', 'build' ] );
        grunt.registerTask( 'test', [ 'pre-test', 'git-build', 'jshint', 
'jscs', 'csslint', 'banana', 'qunit' ] );
        grunt.registerTask( 'default', 'test' );
diff --git a/package.json b/package.json
index f87dbe4..4de9235 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
     "grunt-contrib-clean": "0.5.0",
     "grunt-contrib-concat-sourcemaps": "0.6.0",
     "grunt-contrib-csslint": "0.2.0",
+    "grunt-contrib-cssmin": "0.10.0",
     "grunt-contrib-jshint": "0.10.0",
     "grunt-contrib-less": "0.11.4",
     "grunt-contrib-qunit": "0.4.0",

-- 
To view, visit https://gerrit.wikimedia.org/r/157315
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8f8194141d644804d3378556ea126ba8597584c
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Jforrester <jforres...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to