Last active
December 18, 2015 02:54
-
-
Save gecugamo/f728dc26b62a0b3631f1 to your computer and use it in GitHub Desktop.
Gruntfile.js with SASS and PostCSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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