-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
175 lines (143 loc) · 5.54 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
module.exports = function(grunt) {
// To support Coffeescript, SASS, LESS and others, just install
// the appropriate grunt package and it will be automatically included
// in the build process:
//
// * for Coffeescript, run `npm install --save-dev grunt-contrib-coffee`
//
// * for SASS (SCSS only), run `npm install --save-dev grunt-sass`
// * for SCSS/SASS support (may be slower), run
// `npm install --save-dev grunt-contrib-sass`
// This depends on the ruby sass gem, which can be installed with
// `gem install sass`
//
// * for LESS, run `npm install --save-dev grunt-contrib-less`
//
// * for Stylus/Nib, `npm install --save-dev grunt-contrib-stylus`
//
// * for Compass, run `npm install --save-dev grunt-contrib-compass`
// This depends on the ruby compass gem, which can be installed with
// `gem install compass`
// You should not install SASS if you have installed Compass.
//
// * for Emblem, run the following commands:
// `npm uninstall --save-dev grunt-ember-templates`
// `npm install --save-dev grunt-emblem`
// `bower install emblem.js --save`
//
// * for LiveReload, `npm install --save-dev connect-livereload`
//
// If you use SASS, LESS or Stylus, don't forget to delete
// `public/assets/app.css` and create `app/styles/app.scss` instead.
var Helpers = require('./tasks/helpers'),
filterAvailable = Helpers.filterAvailableTasks;
Helpers.pkg = require("./package.json");
var config = require('load-grunt-config')(grunt, {
configPath: "tasks/options",
init: false
});
grunt.loadTasks('tasks');
config.env = process.env;
// App Kit's Main Tasks
// ====================
// Default Task
// ------------------
grunt.registerTask('default', "Build (in debug mode) & test your application.", ['test']);
// Building
// --------
grunt.registerTask('build:dist', "Build a minified & production-ready version of your app.", [
'clean:build',
'clean:release',
'copy:stage',
'lock',
'concurrent:dist', // Main phase, see config below
'unlock',
'dom_munger:distEmber',
'dom_munger:distHandlebars',
'useminPrepare',
'concat',
'uglify',
'copy:dist',
'rev',
'usemin'
]);
grunt.registerTask('build:debug', "Build a development-friendly version of your app.", [
'clean:build',
'copy:stage',
'lock',
'concurrent:debug', // Main phase, see config below
'unlock'
]);
// Testing
// -------
grunt.registerTask('test', "Run your apps's tests once. Uses Google Chrome by default. Logs coverage output to tmp/public/coverage.", [
'build:debug', 'karma:test' ]);
grunt.registerTask('test:ci', "Run your app's tests in PhantomJS. For use in continuous integration (i.e. Travis CI).", [
'build:debug', 'karma:ci' ]);
grunt.registerTask('test:browsers', "Run your app's tests in multiple browsers (see tasks/options/karma.js for configuration).", [
'build:debug', 'karma:browsers' ]);
grunt.registerTask('test:server', "Start a Karma test server. Automatically reruns your tests when files change and logs the results to the terminal.", [
'build:debug',
'karma:server',
'connect:server',
'watch'
]);
// Development Servers
// -------------------
grunt.registerTask('server', "Run your server in development mode, auto-rebuilding when files change.", [
'build:debug',
'connect:server',
'watch'
]);
grunt.registerTask('server:dist', "Build and preview production (minified) assets.", [
'build:dist',
'connect:dist:keepalive'
]);
// Inner workings of the build tasks
// =================================
// Parallelize most of the build process
config.concurrent = {
dist: [
"buildTemplates:dist",
"buildScripts",
"buildStyles",
"buildOther"
],
debug: [
"buildTemplates:debug",
"buildScripts",
"buildStyles",
"buildOther"
]
};
// Templates
grunt.registerTask('buildTemplates:dist', filterAvailable([
'emblem:compile',
'emberTemplates:dist'
]));
grunt.registerTask('buildTemplates:debug', filterAvailable([
'emblem:compile',
'emberTemplates:debug'
]));
// Scripts
grunt.registerTask('buildScripts', filterAvailable([
'coffee',
'copy:prepare',
'transpile',
'jshint',
'concat_sourcemap'
]));
// Styles
grunt.registerTask('buildStyles', filterAvailable([
'compass:compile',
'sass:compile',
'less:compile',
'stylus:compile',
'cssmin'
]));
// Other
grunt.registerTask('buildOther', filterAvailable([
'copy:vendor'
]));
grunt.initConfig(config);
};