Skip to content

Instantly share code, notes, and snippets.

@jeserkin
Created June 12, 2014 08:17
Show Gist options
  • Save jeserkin/d8f1c522d3d6664203ae to your computer and use it in GitHub Desktop.
Save jeserkin/d8f1c522d3d6664203ae to your computer and use it in GitHub Desktop.
var cp = require('child_process');
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-karma');
grunt.initConfig({
jshint: {
files: ['Gruntfile.js', 'package.json', 'src/**/*.js'],
options: {
}
},
html2js: {
options: {
base: '',
module: 'templates',
rename: function (moduleName) {
return '/' + moduleName;
}
},
main: {
src: ['src/**/*.html', '!src/**/index.html', '!src/**/solution/*.html'],
dest: 'tmp/templates.js'
}
},
karma: {
options: {
frameworks: ['jasmine'],
files: [
'lib/jquery-1.10.2.js',
'lib/positioning.js',
'lib/angular.js',
'lib/angular-mocks.js',
'lib/jasmine-matchers.js',
'lib/moment.js',
'src/01_widgets/demo/*.js',
'src/**/*.html'
],
exclude: [
'src/**/index.html'
],
//browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'],
browsers: ['PhantomJS'],
ngHtml2JsPreprocessor: {
prependPrefix: '/',
// setting this option will create only a single module that contains templates
// from all the files, so you can load them all with module('templates')
moduleName: 'templates'
}
},
tdd: {
autoWatch: true
},
ci: {
singleRun: true
}
},
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 9000,
base: '.',
keepalive: true,
middleware: function(connect, options){
return [
connect.static(options.base),
connect.directory(options.base)
];
}
}
}
}
});
grunt.registerTask('tdd', ['karma:tdd']);
grunt.registerTask('default', ['jshint', 'html2js', 'karma:ci']);
grunt.registerTask('server', ['connect:server']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment