Commit dc0928d0 authored by Thomas Park's avatar Thomas Park
Browse files

add autoprefixer

parent a240cb46
module.exports = function (grunt) { module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
var configBridge = grunt.file.readJSON('./bower_components/bootstrap/grunt/configBridge.json', { encoding: 'utf8' });
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
...@@ -46,6 +49,14 @@ module.exports = function (grunt) { ...@@ -46,6 +49,14 @@ module.exports = function (grunt) {
files: {} files: {}
} }
}, },
autoprefixer: {
options: {
browsers: configBridge.config.autoprefixerBrowsers
},
dist: {
src: ['*/bootstrap.css', '*/bootstra.min.css']
}
},
watch: { watch: {
files: ['*/variables.less', '*/bootswatch.less', '*/index.html'], files: ['*/variables.less', '*/bootswatch.less', '*/index.html'],
tasks: 'build', tasks: 'build',
...@@ -103,10 +114,15 @@ module.exports = function (grunt) { ...@@ -103,10 +114,15 @@ module.exports = function (grunt) {
grunt.config('less.dist.files', files); grunt.config('less.dist.files', files);
grunt.config('less.dist.options.compress', false); grunt.config('less.dist.options.compress', false);
grunt.task.run(['concat', 'less:dist', 'clean:build', grunt.task.run(['concat', 'less:dist', 'prefix:' + lessDest, 'clean:build',
compress ? 'compress:'+lessDest+':'+'<%=builddir%>/' + theme + '/bootstrap.min.css':'none']); compress ? 'compress:'+lessDest+':'+'<%=builddir%>/' + theme + '/bootstrap.min.css':'none']);
}); });
grunt.registerTask('prefix', 'autoprefix a generic css', function(fileSrc) {
grunt.config('autoprefixer.dist.src', fileSrc);
grunt.task.run('autoprefixer');
});
grunt.registerTask('compress', 'compress a generic css', function(fileSrc, fileDst) { grunt.registerTask('compress', 'compress a generic css', function(fileSrc, fileDst) {
var files = {}; files[fileDst] = fileSrc; var files = {}; files[fileDst] = fileSrc;
grunt.log.writeln('compressing file ' + fileSrc); grunt.log.writeln('compressing file ' + fileSrc);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"devDependencies": { "devDependencies": {
"bower": "~1.2.8", "bower": "~1.2.8",
"grunt": "~0.4.2", "grunt": "~0.4.2",
"grunt-autoprefixer": "~1.0.1",
"grunt-contrib-clean": "~0.5.0", "grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.3.0", "grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.8.0", "grunt-contrib-connect": "~0.8.0",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment