Skip to content

Instantly share code, notes, and snippets.

@afryer
Created May 22, 2013 06:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afryer/5625638 to your computer and use it in GitHub Desktop.
Save afryer/5625638 to your computer and use it in GitHub Desktop.
grunt boilerplate
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dev: {
options: {
sassDir: '<%= pkg.root %>/sass',
cssDir: '<%= pkg.root %>/stylesheets'
}
},
dist: {
options: {
sassDir: '<%= pkg.root %>/sass',
cssDir: '<%= pkg.dist %>/stylesheets'
}
}
},
concat: {
options: {
separator: ';'
},
dist: {
src: ['<%= pkg.root %>/scripts/**/*.js'],
dest: '<%= pkg.dist %>/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: '<%= pkg.root %>/scripts/**/*.js',
dest: '<%= pkg.dist %>/<%= pkg.name %>.min.js'
}
},
jshint: {
files: ['gruntfile.js', '<%= pkg.root %>/scripts/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: false,
console: true,
module: true,
document: true
}
}
},
watch: {
css: {
files: [ '<%= pkg.root %>/sass/*.scss' ],
tasks: ['compass:dev']
},
js: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
},
all: {
files: ['<%= jshint.files %>','<%= pkg.root %>/sass/*.scss'],
tasks: ['jshint', 'compass']
}
},
connect: {
server: {
options: {
port: 9001,
keepalive:true,
base: './<%= pkg.root %>/'
}
}
},
sass: { // Task
dist: { // Target
files: { // Dictionary of files
'<%= pkg.root %>/stylesheets/styles.css': '<%= pkg.root %>/sass/styles.scss', // 'destination': 'source'
}
},
dev: { // Another target
options: { // Target options
style: 'expanded'
},
files: {
'<%= pkg.root %>/stylesheets/styles.css': '<%= pkg.root %>/sass/styles.scss', // 'destination': 'source'
}
}
}
});
// Load the plugin
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-sass');
// Default task(s).
grunt.registerTask('dev', ['watch:css']);
grunt.registerTask('default', ['uglify']);
};
{
"name": "gruntboilerplate",
"version": "0.0.0",
"description": "grunt boilerplate",
"main": "gruntfile.js",
"keywords": [
"grunt",
"boilerplate"
],
"root":"www",
"dist" :"dist",
"author": "Anthony Fryer",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-nodeunit": "0.1.2rc6",
"grunt-contrib-uglify": "~0.1.1",
"grunt-contrib-concat": "~0.1.2",
"grunt-contrib-watch": "~0.2.0",
"grunt-contrib-compass": "~0.1.2",
"grunt-contrib-connect": "~0.1.2",
"grunt-contrib-sass": "~0.3.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment