-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathGruntfile.js
50 lines (44 loc) · 1.3 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var _ = require('underscore')._;
var RJSConfig = require('./src/config');
module.exports = function(grunt) {
// Add require.js to the paths.
RJSConfig.paths = _.extend(RJSConfig.paths, {
'require-lib': '../node_modules/requirejs/require'
});
// Include EVERY path in the distributable.
RJSConfig.include = [];
_.each(RJSConfig.paths, function(path, key) {
RJSConfig.include.push(key);
});
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
requirejs: {
compile: {
options: _.extend(RJSConfig, {
name: 'config',
out: 'dist/my-proj.js',
baseUrl: './src',
generateSourceMaps: true,
optimize: 'uglify2',
optimizeAllPluginResources: true,
preserveLicenseComments: false
})
}
},
mocha: {
options: {
reporter: 'Nyan', // Duh!
run: true
}
}
});
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.registerTask('test', 'Run Mocha tests.', function() {
// If not --test option is specified, run all tests.
var test_case = grunt.option('test') || '**/*';
grunt.config.set('mocha.browser', ['test/' + test_case + '.html']);
grunt.task.run('mocha');
});
grunt.registerTask('dist', ['requirejs']);
};