-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
101 lines (88 loc) · 2.29 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
module.exports = function (grunt) {
var appConfig = grunt.file.readJSON('package.json');
// Load grunt tasks automatically
// see: https://github.com/sindresorhus/load-grunt-tasks
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
// see: https://npmjs.org/package/time-grunt
require('time-grunt')(grunt);
var pathsConfig = function (appName) {
this.app = appName || appConfig.name;
return {
app: this.app,
templates: this.app + '/templates',
css: this.app + '/static/css',
sass: this.app + '/static/sass',
fonts: this.app + '/static/fonts',
images: this.app + '/static/images',
js: this.app + '/static/js',
manageScript: this.app + '/manage.py'
}
};
grunt.initConfig({
paths: pathsConfig(),
pkg: appConfig,
// see: https://github.com/gruntjs/grunt-contrib-watch
watch: {
gruntfile: {
files: ['Gruntfile.js']
},
compass: {
files: ['<%= paths.sass %>/**/*.{scss,sass}'],
tasks: ['compass:server']
},
livereload: {
files: [
'<%= paths.js %>/**/*.js',
'<%= paths.sass %>/**/*.{scss,sass}',
'<%= paths.app %>/**/*.html'
],
options: {
spawn: false,
livereload: true,
},
},
},
// see: https://github.com/gruntjs/grunt-contrib-compass
compass: {
options: {
sassDir: '<%= paths.sass %>',
cssDir: '<%= paths.css %>',
fontsDir: '<%= paths.fonts %>',
imagesDir: '<%= paths.images %>',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10\n'
},
dist: {
options: {
environment: 'production'
}
},
server: {
options: {
// debugInfo: true
}
}
},
// see: https://npmjs.org/package/grunt-bg-shell
bgShell: {
_defaults: {
bg: true
},
runDjango: {
cmd: 'python <%= paths.manageScript %> runserver'
}
}
});
grunt.registerTask('serve', [
'bgShell:runDjango',
'watch'
]);
grunt.registerTask('build', [
'compass:dist'
]);
grunt.registerTask('default', [
'build'
]);
};