This repository has been archived by the owner on Sep 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGruntfile.js
70 lines (64 loc) · 1.86 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
'using strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jshint: {
code: [
'Gruntfile.js',
'tasks/hogan.js',
'example/Gruntfile.js',
'tasks/binders.js'],
options: {
jshintrc: '.jshintrc'
}
},
//Make a shell call
shell: {
bootstrap: {
//To the hulk CLI
command:
'node '+
__dirname +
'/node_modules/hogan.js/bin/hulk '+
__dirname +
'/view/binder/*.hogan',
options: {
stdout: false,
stderr: false,
//But catch the output
callback: function log(err, stdout, stderr, cb) {
//And handle errors (if any)
if (err) {
grunt.log.errorlns(err);
}
else if (stderr) {
grunt.log.errorlns(stderr);
}
else {
//Otherwise load a lodash template
var template = grunt.file.read(
__dirname +
'/view/binders.lodash');
//process it with the hulk result
var result = grunt.template.process(template, {data: {stdout: stdout}});
//And write out our bootstrap module
grunt.file.write(
__dirname +
'/tasks/binders.js',
result
);
grunt.log.ok('hulk: generated binders.js');
cb();
}
}
}
}
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('default', ['shell:bootstrap', 'jshint']);
};