-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
130 lines (113 loc) · 2.75 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
129
130
var path = require('path');
module.exports = function (grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
express: {
options: {
script: 'app.js',
output: 'Server is running'
},
dev: {
options: {
output: ".+" // Matching this output indicates that server is running
}
}
},
jshint: {
options: {
globalstrict : true,
trailing: true
},
src: ['public_src/js/**/*.js', '!public_src/js/libs/**/*.js']
},
uglify: {
build: {
files: {
'public/js/main.min.js': ['public/js/main.js']
}
}
},
compass: {
dist: {
options: {
config: '.compassrc.rb'
}
}
},
cssmin: {
build: {
src: 'public/css/screen.css',
dest: 'public/css/screen.min.css'
}
},
browserify: {
js: {
src: 'public_src/js/main.js',
dest: 'public/js/main.js'
},
test: {
src: 'tests/tests.js',
dest: 'tests/tests.bundle.js'
}
},
qunit: {
all: ['tests/**/*.html']
},
watch: {
js: {
files: ['public_src/js/**/*.js'],
tasks: ['js_dev'],
options: {
livereload: true,
spawn: true
}
},
test: {
files: ['tests/tests.js'],
tasks: ['browserify:test', 'qunit'],
options: {
livereload: true
}
},
lint: {
files: ['public_src/js/**/*.js'],
tasks: ['jshint']
},
css: {
files: ['public_src/scss/**/*.scss'],
tasks: ['css_dev'],
options: {
livereload: true,
spawn: true
}
},
express: {
// Restart any time client or server js files change
files: ['app.js'],
tasks: ['express:dev'],
options: {
//Without this option specified express won't be reloaded
spawn: false
}
}
},
shell: {
bower: {
command: path.resolve(__dirname + '/node_modules/.bin/bower install'),
options: {
stdout: true,
stderr: true,
failOnError: true
}
}
}
});
grunt.registerTask('default', ['dev']);
grunt.registerTask('dev', ['shell:bower', 'css_dev', 'js_dev', 'express:dev', 'watch']);
grunt.registerTask('all', ['shell:bower', 'compass', 'cssmin', 'browserify', 'uglify', 'qunit']);
grunt.registerTask('css_prod', ['compass', 'cssmin']);
grunt.registerTask('js_prod', ['browserify', 'uglify']);
grunt.registerTask('css_dev', ['compass']);
grunt.registerTask('js_dev', ['browserify']);
};