-
Notifications
You must be signed in to change notification settings - Fork 0
/
grunt.js
72 lines (55 loc) · 1.33 KB
/
grunt.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
71
72
var fs = require('fs');
module.exports = function (grunt) {
var FILES = [
// HELPERS AND EXTENSIONS
'<%= dirs.src %>core/mutators.js',
// CORE
'<%= dirs.src %>core/core.js',
'<%= dirs.src %>core/object.js',
'<%= dirs.src %>core/binding.js',
// DATA
'<%= dirs.src %>data/store.js',
'<%= dirs.src %>data/model.js',
'<%= dirs.src %>data/model-array.js',
// VIEW
'<%= dirs.src %>views/view.js',
// ROUTER
'<%= dirs.src %>router/history.js',
'<%= dirs.src %>router/router.js'
];
grunt.initConfig({
pkg: '<json:package.json>',
dirs: {
src: 'src/',
dest: 'dist/'
},
lint: {
all: FILES
},
concat: {
dist: {
src: FILES,
dest: '<%= dirs.dest %>gelatin-<%= pkg.version %>.js'
}
},
min: {
dist: {
src: '<%= concat.dist.dest %>',
dest: '<%= dirs.dest %>gelatin-<%= pkg.version %>-min.js'
}
},
watch: {
files: FILES,
tasks: ['concat:dist', 'wrap', 'min:dist']
},
wrap: {
src: '<%= concat.dist.dest %>'
}
});
grunt.registerMultiTask('wrap', 'Wraps the gelatin source in a closure', function () {
var data = fs.readFileSync(this.file.src, 'utf8')
fs.writeFileSync(this.file.src, '(function() {' + data + '})();', 'utf8');
});
grunt.registerTask('default', 'lint');
grunt.registerTask('build', ['concat:dist', 'wrap', 'min:dist']);
};