Skip to content

Instantly share code, notes, and snippets.

@gecugamo
Last active December 18, 2015 02:54
Show Gist options
  • Save gecugamo/f728dc26b62a0b3631f1 to your computer and use it in GitHub Desktop.
Save gecugamo/f728dc26b62a0b3631f1 to your computer and use it in GitHub Desktop.
Gruntfile.js with SASS and PostCSS
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
sourcemap: 'none'
},
files: {
'assets/css/style.css': 'assets/scss/main.scss'
}
}
},
postcss: {
options: {
map: true,
processors: [
require('pixrem')(), // fallbacks for rem units
require('autoprefixer')({browsers: ['last 2 versions']}),
require('cssnano')() // minify the result
]
},
dist: {
src: 'assets/css/style.css'
}
},
watch: {
grunt: {
options: {
reload: true
},
files: ['Gruntfile.js']
},
css: {
files: ['assets/scss/*.scss', 'assets/scss/**/*.scss'],
tasks: ['sass', 'postcss']
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('default', ['watch']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment