Skip to content

Instantly share code, notes, and snippets.

@bsima
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsima/a30dd43ccc5ffed7922a to your computer and use it in GitHub Desktop.
Save bsima/a30dd43ccc5ffed7922a to your computer and use it in GitHub Desktop.
Grunt task(s) for compiling SASS and autoprefixing
/**
* Grunt task(s) for compiling SASS and autoprefixing
*
* To use:
*
* npm install grunt --save-dev
* npm install grunt-contrib-sass --save-dev
* npm install grunt-autoprefixer --save-dev
* npm install grunt-contrib-watch --save-dev
* curl --output Gruntfile.js https://gist.github.com/bsima/a30dd43ccc5ffed7922a/download
* grunt watch
*/
module.exports = function(grunt) {
grunt.initConfig({
sass: {
dist: {
files: {
'sass.css': 'main.scss',
}
}
},
autoprefixer: {
dist: {
files: {
'main.css': 'sass.css'
}
}
},
watch: {
styles: {
files: ['main.scss'],
tasks: ['sass','autoprefixer']
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-watch');
// Notify when a watched file is modified
grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment