Skip to content

Instantly share code, notes, and snippets.

@jessekinsman
Last active Aug 29, 2015
Embed
What would you like to do?
Grunt configuration for using autoprefixer with Zurb Foundation
// After some debugging, got this working. Didn't see it documented anywhere so thought I would put this up to help any others
// First install the grunt-postcss and autoprefixer-core npm repositiories
// Looks like this: npm install grunt-postcss autoprefixer-core
var autoprefixer = require('autoprefixer-core');
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
includePaths: ['bower_components/foundation/scss']
},
dist: {
options: {
outputStyle: 'compressed'
},
files: {
'css/app.css': 'scss/app.scss'
}
}
},
postcss: {
options: {
processors: [
autoprefixer({ browsers: ['last 2 version'] }).postcss
]
},
dist: { src: 'css/app.css'}
},
watch: {
grunt: { files: ['Gruntfile.js'] },
postcss: {
files: 'css/app.css',
tasks: 'postcss',
options: {
nospawn: true
}
},
sass: {
files: 'scss/**/*.scss',
tasks: ['sass']
}
}
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('build', ['sass']);
grunt.registerTask('default', ['build','watch']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment