Skip to content

Instantly share code, notes, and snippets.

@samuelhorn
Created October 30, 2013 06:31
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 samuelhorn/7228011 to your computer and use it in GitHub Desktop.
Save samuelhorn/7228011 to your computer and use it in GitHub Desktop.
My personal gruntfile
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dev: {
options: {
style: 'expanded'
},
src: ['scss/style.scss'],
dest: 'style.css'
},
prod: {
options: {
style: 'compressed'
},
src: ['scss/style.scss'],
dest: 'style.css'
}
},
htmlmin: {
prod: {
options: {
removeComments: true,
collapseWhitespace: true,
removeEmptyAttributes: true,
removeCommentsFromCDATA: true,
removeRedundantAttributes: true,
collapseBooleanAttributes: true
},
files: {
'./index-min.html': './index.html'
}
}
},
watch: {
css: {
files: ['**/*.scss'],
tasks: ['development'],
options: {
livereload: true
},
},
}
});
// Load NPM's via matchdep
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Development task
grunt.registerTask('development', ['sass:dev']);
// Distrubution Task
grunt.registerTask('production', ['sass:prod', 'htmlmin:prod']);
}
{
"name": "grunttest",
"version": "0.0.1",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-watch": "~0.4.3",
"grunt-contrib-uglify": "~0.2.5",
"grunt-contrib-sass": "~0.5.0",
"matchdep": "~0.1.2",
"grunt-contrib-htmlmin": "~0.1.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment