-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
131 lines (110 loc) · 3.09 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
bgShell: {
install: {
cmd: 'pyvenv-3.5 '+ __dirname +'/environment && source '+ __dirname +'/environment/bin/activate && pip install -r requirements.txt',
bg: false,
stdout: false
},
server: {
cmd: 'source '+ __dirname +'/environment/bin/activate && python server.py',
bg: false,
stdout: false
}
},
handlebars: {
compile: {
options: {
namespace: "templates",
processContent: function(content, filepath) {
content = content.replace(/^[\x20\t]+/mg, '').replace(/[\x20\t]+$/mg, '');
content = content.replace(/^[\r\n]+/, '').replace(/[\r\n]*$/, '\n');
return content;
},
processName: function(filePath) {
var name = "";
filePath = filePath.split(".");
filePath = filePath[0].split("/");
name += filePath[3];
for (var i = 4; i < filePath.length; i++) {
name += "/" + filePath[i];
};
return name;
}
},
files: {
"build/templates.js": ["saturdays/templates/_compile/**/*.hbs"]
}
}
},
sass: {
compile: {
options: {
outputStyle: 'compressed'
},
files: {
'build/all.css': 'saturdays/styles/all.scss',
}
}
},
coffee: {
compile: {
files: {
'build/app.js': [
'saturdays/scripts/app.coffee',
'saturdays/scripts/core/**/*.coffee',
'saturdays/scripts/models/**/*.coffee',
'saturdays/scripts/collections/**/*.coffee',
'saturdays/scripts/views/**/*.coffee',
'saturdays/scripts/routers/router.coffee']
}
}
},
open: {
start: {
path: 'http://localhost:5000',
app: 'Google Chrome'
}
},
watch: {
options: {
livereload: {
host: 'localhost',
port: 9000
}
},
html: {
files: ['saturdays/templates/**/*.html']
},
handlebars: {
files: ['saturdays/templates/_compile/**/*.hbs'],
tasks: ['handlebars']
},
sass: {
options: {
livereload: false
},
files: ['saturdays/styles/**/*.scss'],
tasks: ['sass']
},
css: {
files: 'build/all.css'
},
coffee: {
files: ['saturdays/scripts/**/*.coffee'],
tasks: ['coffee']
}
}
});
grunt.loadNpmTasks('grunt-bg-shell');
grunt.loadNpmTasks('grunt-contrib-handlebars');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-open');
grunt.registerTask('install', ['bgShell:install']);
grunt.registerTask('start', ['bgShell:server']);
grunt.registerTask('compilers', ['handlebars', 'sass', 'coffee', 'open', 'watch']);
grunt.registerTask('default', ['compilers']);
};