-
Notifications
You must be signed in to change notification settings - Fork 0
/
grunt.js
44 lines (36 loc) · 1.12 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
"use strict";
var fs = require('fs'),
browserify = require('browserify'),
templatify = require('templatify');
// Setup template bundle
var templateBundle = browserify().
use(templatify('./', {
files: ['./views/*.html', './views/partials/*.html'],
helpers: ['./lib/helpers/*.js']
})
);
var appBundle = browserify('./lib/main.js', {'require': {
'backbone': 'backbone-browserify'}});
module.exports = function(grunt){
grunt.initConfig({
lint: {
all: ['grunt.js']
},
jshint: {
options: {
browser: true
}
}
});
grunt.registerTask('dev', function(){
// Watch for changes and rebuild.
// Dev shell should reload on file changes
});
grunt.registerTask('build', function(){
fs.writeFileSync('./static/js/templates.js', templateBundle.bundle());
appBundle.prepends.splice(0, 1);
appBundle.prepend(fs.readFileSync('./vendor/jquery.js'));
appBundle.prepend(templateBundle.bundle());
fs.writeFileSync('./static/js/app.js', appBundle.bundle());
});
};