Created
May 1, 2014 00:58
-
-
Save akollegger/11442448 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example Gruntfile for webpack | |
module.exports = function (grunt) { | |
'use strict'; | |
require('load-grunt-tasks')(grunt); | |
// Project configuration | |
grunt.initConfig({ | |
// Metadata | |
pkg: grunt.file.readJSON('package.json'), | |
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + | |
'<%= grunt.template.today("yyyy-mm-dd") %>\n' + | |
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + | |
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + | |
' Licensed <%= props.license %> */\n', | |
// Task configuration | |
webpack: { | |
global: { | |
// webpack options | |
entry: "./src/entry.js", | |
output: { | |
path: "lib", | |
filename: "bundle.js", | |
libraryTarget: 'umd', | |
library: "WithGrunt" | |
}, | |
resolve: { | |
modulesDirectories: ['node_modules', 'bower_components'], | |
}, | |
stats: { | |
// Configure the console output | |
colors: true, | |
modules: true, | |
reasons: true | |
}, | |
failOnError: true, // don't report error to grunt if webpack find errors | |
} | |
}, | |
jshint: { | |
options: { | |
node: true, | |
curly: true, | |
eqeqeq: true, | |
immed: true, | |
latedef: true, | |
newcap: true, | |
noarg: true, | |
sub: true, | |
undef: true, | |
unused: false, | |
eqnull: true, | |
browser: true, | |
globals: { | |
jQuery: true, | |
"define": false, | |
/* MOCHA */ | |
"suite": false, | |
"test": false, | |
"before": false, | |
"beforeEach": false, | |
"after": false, | |
"afterEach": false, | |
"describe": false, | |
"it": false | |
}, | |
boss: true | |
}, | |
gruntfile: { | |
src: 'gruntfile.js' | |
}, | |
src_test: { | |
src: ['src/**/*.js', 'test/**/*.js'] | |
} | |
}, | |
mochaTest: { | |
test: { | |
options: { | |
reporter: 'spec', | |
clearRequireCache: true | |
}, | |
src: ['test/**/*.js'] | |
}, | |
}, | |
watch: { | |
gruntfile: { | |
files: '<%= jshint.gruntfile.src %>', | |
tasks: ['jshint:gruntfile'] | |
}, | |
lib_test: { | |
files: '<%= jshint.lib_test.src %>', | |
tasks: ['jshint:lib_test', 'mochaTest'] | |
} | |
} | |
}); | |
// Default task | |
grunt.registerTask('default', ['jshint', 'webpack', 'mochaTest']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment