Skip to content

Commit

Permalink
(css) Minify CSS using clean-css
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Jun 22, 2016
1 parent d8dc443 commit cd3e742
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
3 changes: 2 additions & 1 deletion NEWS
@@ -1,4 +1,4 @@
3.1.3 (2016-MM-DD)
3.1.3 (2016-06-22)
------------------

New features
Expand All @@ -12,6 +12,7 @@ Enhancements
- [web] always display name of month in week view (#3724)
- [web] use a speed dial (instead of a dialog) for card/list creation
- [web] use a speed dial for event/task creation
- [web] CSS is now minified using clean-css

Bug fixes
- [core] properly handle sorted/deleted calendars (#3723)
Expand Down
43 changes: 19 additions & 24 deletions UI/WebServerResources/Gruntfile.js
@@ -1,3 +1,4 @@
// Load Grunt
module.exports = function(grunt) {
var js_files = {
'js/Common.js': ['js/Common/*.app.js', 'js/Common/*.filter.js', 'js/Common/*Controller.js', 'js/Common/*.service.js', 'js/Common/*.directive.js', 'js/Common/utils.js'],
Expand All @@ -23,6 +24,7 @@ module.exports = function(grunt) {

require('time-grunt')(grunt);

// Tasks
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
Expand All @@ -34,34 +36,14 @@ module.exports = function(grunt) {
'bower_components/breakpoint-sass/stylesheets/'
]
},
dist: {
target: {
files: {
'css/styles.css': 'scss/styles.scss'
},
options: {
outputStyle: 'compressed'
}
},
dev: {
files: {
'css/styles.css': 'scss/styles.scss'
}
}
},
postcss: {
dist: {
options: {
map: false,
processors: [
require('autoprefixer')({browsers: '> 1%, last 2 versions, last 3 Firefox versions'}),
// minifier
require('csswring').postcss
]
// We may consider using css grace (https://github.com/cssdream/cssgrace) for larger support
},
src: 'css/styles.css'
},
dev: {
target: {
options: {
map: true,
processors: [
Expand All @@ -72,6 +54,16 @@ module.exports = function(grunt) {
src: 'css/styles.css'
}
},
cssmin: {
options: {
sourceMap: true,
},
target: {
files: {
'css/styles.css': 'css/styles.css'
}
}
},
jshint: {
files: [].concat(Object.keys(js_files).map(function(v) { return js_files[v]; }))
},
Expand Down Expand Up @@ -115,12 +107,15 @@ module.exports = function(grunt) {
}
});

// Load Grunt plugins
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');

// Register Grunt tasks
grunt.task.registerTask('static', function() {
var options = {
'src': 'bower_components',
Expand Down Expand Up @@ -183,10 +178,10 @@ module.exports = function(grunt) {
*/
grunt.task.run('uglify:vendor');
});
grunt.task.registerTask('build', ['static', 'uglify:dist', 'sass:dist', 'postcss:dist']);
grunt.task.registerTask('build', ['static', 'uglify:dist', 'sass', 'postcss', 'cssmin']);
// Tasks for developers
grunt.task.registerTask('default', ['watch']);
grunt.task.registerTask('css', ['sass:dev', 'postcss:dev']);
grunt.task.registerTask('css', ['sass', 'postcss']);
grunt.task.registerTask('js', ['jshint', 'uglify:dev']);
grunt.task.registerTask('dev', ['css', 'js']);
};
1 change: 1 addition & 0 deletions UI/WebServerResources/package.json
Expand Up @@ -11,6 +11,7 @@
"grunt-contrib-jshint": ">=0.11.2",
"grunt-contrib-uglify": ">=0.9",
"grunt-contrib-watch": ">=0.5.3",
"grunt-contrib-cssmin": ">=1.0.0",
"grunt-ng-annotate": ">=0.10.0",
"grunt-postcss": ">=0.6.0",
"grunt-sass": ">=0.18.1",
Expand Down

0 comments on commit cd3e742

Please sign in to comment.