-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
142 lines (128 loc) · 3.48 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
131
132
133
134
135
136
137
138
139
140
141
142
/**
*
* Configuration options are loaded from files in tasks/options
*
* Normally inside this file you'd see:
*
* clean: {
* development: ['file-to-clean']
* }
*
* Instead the file at tasks/options/clean.js contains:
*
* module.exports = {
* development: ['file-to-clean']
* }
*
* Sharing Configuration Options:
*
* Configuration options used across multiple modules are set in the following
* manner:
*
* `grunt.config('settings', settings);`
* `grunt.config('paths', settings.paths);`
*
*
* Furthermore, getting those options occurs in a similar fashion:
*
* `grunt.config('paths.output.js');` //=> public/js
*
* Using the conventional <%= paths.output.js %> will NOT work
*
*/
module.exports = function(grunt) {
var settings = {
liveReloadPort: process.env.LRPORT || 35729,
port: process.env.PORT || 8000,
mochaPhantomPort: process.env.MOCHA_PHANTOM_PORT || 8001,
hostname: 'localhost',
templates: {},
paths: {
'public': 'public',
dist: 'dist',
tmp: 'tmp',
distOutput: {
js: 'dist/main.js',
},
output: {
js: 'public/js',
css: 'public/css'
},
js: 'js',
css: 'css',
templates: 'js/templates',
views: 'js/views',
models: 'js/models',
collections: 'js/collections'
}
};
grunt.config('settings', settings);
grunt.config('paths', settings.paths);
grunt.loadNpmTasks('thorax-inspector');
grunt.loadTasks('tasks');
grunt.registerTask('styles:development', [
'clean:styles',
'styles'
]);
grunt.registerTask('build', [
'ensure-installed',
'jshint:all'
]);
/**
* livereload tests + app + jshint when saving a file
*/
grunt.registerTask('default', [
'build',
'styles:development',
'thorax:inspector',
'connect:development',
'watch'
]);
/**
* same as default `grunt` but also runs karma tests on file save
*
* a faster approach is to actually run the default task and in a seperate
* terminal run `karma start` which will bypass grunt's slow file watching,
* shaving off about a second on autoreload, however, you'll need to deal
* with having to restart two different windows in the event of something
* drastic.
*/
grunt.registerTask('autotest', [
'build',
'styles:development',
'thorax:inspector',
'karma:server',
'connect:development',
'watch'
]);
// compile production ready assets to dist/
grunt.registerTask('production', [
'clean:production',
'build',
'styles:development',
'cssmin',
'copy:prepareBuild',
'requirejs:production'
// 'connect:production'
]);
// aliased as npm test, and therefore used by travis ci
grunt.registerTask('test', [
'build',
'karma:ci'
]);
// run tests one time in chrome, firefox, safari
grunt.registerTask('test-deploy', [
'build',
'karma:deploy'
]);
// manually run grunt within a terminal window, provides nicer UI output
// than karma
grunt.registerTask('test-mocha-phantomjs', [
'build',
'connect:CIServer',
'mocha_phantomjs'
]);
require('load-grunt-config')(grunt, {
configPath: __dirname + '/tasks/options'
});
};