Skip to content

Instantly share code, notes, and snippets.

Created January 23, 2015 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/2f0f91cd791a6ceb5dc7 to your computer and use it in GitHub Desktop.
Save anonymous/2f0f91cd791a6ceb5dc7 to your computer and use it in GitHub Desktop.
'use strict';
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-hapi');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
project: {
app: ['app'],
scss: ['<%= project.app %>/sass/style.scss'],
css: ['<%= project.app %>/css/**/*.css'],
alljs: ['<%= project.app %>/js/**/*.js']
},
wiredep: {
task: {
src: [
'<%= project.app %>/*.html',
'<%= project.app %>/sass/style.scss'
]
}
},
clean: {
dev: {
src: ['build/']
}
},
copy: {
dev: {
expand: true,
cwd: 'app/',
src: ['*.html', '<%= project.css %>', '<%= project.app %>/css/*.css.map'],
dest: 'build/',
filter: 'isFile'
}
},
jshint: {
all: ['<%= project.alljs %>', 'Gruntfile.js', 'server.js'],
options: {
jshintrc: true
}
},
jscs: {
src: ['<%= project.alljs %>', 'server.js', 'Gruntfile.js'],
options: {
config: '.jscsrc'
}
},
browserify: {
dev: {
options: {
debug: true
},
src: ['<%= project.alljs %>'],
dest: 'build/js/app.js'
}
},
karma: {
unit: {
configFile: 'karma.conf.js'
},
continuous: {
configFile: 'karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
}
},
sass: {
dev: {
options: {
style: 'expanded',
compass: false
},
files: {
'build/css/style.css':'<%= project.scss %>'
}
}
},
hapi: {
development: {
options: {
server: require('path').resolve('./server'),
bases: {
'/': require('path').resolve('./build/')
}
}
}
},
watch: {
sass: {
files: '<%= project.app %>/sass/{,*/}*.{scss,sass}',
tasks: ['build']
},
test: {
files: ['<%= project.alljs %>', 'test/front-end/**/*.js'],
tasks: ['build:dev', 'karma:unit']
}
}
}); //end initConfig
grunt.registerTask('build', ['clean:dev', 'sass:dev', 'copy:dev']);
grunt.registerTask('test', ['build:dev', 'karma:continuous']);
grunt.registerTask('default', ['test', 'watch']);
grunt.registerTask('serve', ['build:dev', 'hapi', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment