Added grunt-postcss to auto-prefix the css files + minify all css files.

This commit is contained in:
Mads Rasmussen
2015-08-24 12:22:51 +02:00
parent 8d70265f02
commit c0b06a4cec
2 changed files with 24 additions and 14 deletions

View File

@@ -17,11 +17,11 @@ module.exports = function (grunt) {
grunt.registerTask('watch-canvasdesigner', ['copy:canvasdesigner', 'concat:canvasdesignerJs', 'copy:vs']);
grunt.registerTask('watch-test', ['jshint:dev', 'karma:unit']);
//triggered from grunt dev or grunt
grunt.registerTask('build', ['clean', 'concat', 'recess:min', 'recess:installer', 'recess:canvasdesigner', 'bower-install-simple', 'bower', 'copy']);
//triggered from grunt
grunt.registerTask('build', ['clean', 'concat', 'recess:build', 'recess:installer', 'recess:canvasdesigner', 'postcss', 'bower-install-simple', 'bower', 'copy']);
//build-dev doesn't min - we are trying to speed this up and we don't want minified stuff when we are in dev mode
grunt.registerTask('build-dev', ['clean', 'concat', 'recess:build', 'recess:installer', 'bower-install-simple', 'bower', 'copy']);
//triggered from grunt dev vs or grunt vs
grunt.registerTask('build-dev', ['clean', 'concat', 'recess:build', 'recess:installer', 'postcss', 'bower-install-simple', 'bower', 'copy']);
//utillity tasks
grunt.registerTask('docs', ['ngdocs']);
@@ -281,7 +281,8 @@ module.exports = function (grunt) {
['<%= src.less %>']
},
options: {
compile: true
compile: true,
compress: true
}
},
installer: {
@@ -290,7 +291,8 @@ module.exports = function (grunt) {
['src/less/installer.less']
},
options: {
compile: true
compile: true,
compress: true
}
},
canvasdesigner: {
@@ -298,14 +300,6 @@ module.exports = function (grunt) {
'<%= distdir %>/assets/css/canvasdesigner.css':
['src/less/canvas-designer.less', 'src/less/helveticons.less']
},
options: {
compile: true
}
},
min: {
files: {
'<%= distdir %>/assets/css/<%= pkg.name %>.css': ['<%= src.less %>']
},
options: {
compile: true,
compress: true
@@ -313,6 +307,19 @@ module.exports = function (grunt) {
}
},
postcss: {
options: {
processors: [
// add vendor prefixes
require('autoprefixer-core')({
browsers: 'last 2 versions'
})
]
},
dist: {
src: '<%= distdir %>/assets/css/<%= pkg.name %>.css'
}
},
watch: {
docs: {
@@ -509,6 +516,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-karma');

View File

@@ -21,6 +21,7 @@
},
"dependencies": {},
"devDependencies": {
"autoprefixer-core": "~5.2.1",
"bower": "^1.4.1",
"eslint": "^0.23.0",
"eslint-plugin-angular": "0.0.13",
@@ -39,6 +40,7 @@
"grunt-karma": "~0.5",
"grunt-ngdocs": "~0.1.2",
"grunt-open": "~0.2.0",
"grunt-postcss": "~0.6.0",
"grunt-recess": "~0.3",
"karma": "~0.9",
"karma-chrome-launcher": "0.0.2",