Skip to content

Instantly share code, notes, and snippets.

@rbk
Last active August 29, 2015 14:08
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 rbk/be082cc88ded3aa6972e to your computer and use it in GitHub Desktop.
Save rbk/be082cc88ded3aa6972e to your computer and use it in GitHub Desktop.
Sample grunt configuration files for processing sass and compressing javascripts
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'compressed'
},
files: {
'css/app.css' : 'scss/app.scss'
}
}
},
uglify: {
options: {
mangle: true,
compress: {
drop_console: true
}
},
my_target: {
options: {
beautify: true
},
files: {
'js/build/production.min.js': []
}
}
},
watch: {
css: {
files: '**/*.scss',
tasks: ['sass']
},
js: {
files: 'js/*.js',
tasks: ['uglify']
},
livereload: {
files: ['*.html', '**/*.php', 'js/**/*.{js,json}', 'css/*.css','img/**/*.{png,jpg,jpeg,gif,webp,svg}'],
options: {
livereload: true
}
}
}
});
grunt.loadNpmTasks('grunt-livereload');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', [ 'watch' ]);
}
{
"name": "any-project",
"version": "0.0.1",
"description": "grunt",
"private": true,
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.3.3",
"grunt-contrib-sass": "~0.7.3",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-livereload": "^0.1.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment