-
Notifications
You must be signed in to change notification settings - Fork 44
/
gruntfile.js
executable file
·172 lines (162 loc) · 4.94 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
'use strict';
var config = {
app: 'public',
dist: 'dist'
};
module.exports = function(grunt) {
// Project Configuration
grunt.initConfig({
config: config,
pkg: grunt.file.readJSON('package.json'),
watch: {
compass: {
files: ['<%= config.app %>/sass/{,*/}*.{scss,sass}'],
tasks: ['compass:server']
},
neuter: {
files: ['<%= config.app %>/ember/{,*/}*.js'],
tasks: ['neuter', 'replace:sourceMap']
},
serverTemplates: {
files: ['server/views/**'],
options: {
// livereload: true
}
},
emberTemplates: {
files: '<%= config.app %>/ember/templates/**/*.hbs',
tasks: ['emberTemplates'],
options: {
// livereload: true
}
},
js: {
files: ['public/js/**', 'app/**/*.js'],
// tasks: ['jshint'],
options: {
// livereload: true
}
},
css: {
files: ['public/css/**'],
options: {
// livereload: true
}
}
},
compass: {
options: {
sassDir: '<%= config.app %>/sass',
cssDir: 'public/css',
generatedImagesDir: 'public/images/generated',
imagesDir: 'public/img',
javascriptsDir: 'public/ember',
fontsDir: 'public/css/fonts',
importPath: 'public/lib',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/sass/fonts',
relativeAssets: false,
assetCacheBuster: false
},
dist: {
options: {
generatedImagesDir: 'public/images/generated'
}
},
server: {
options: {
debugInfo: true
}
}
},
nodemon: {
dev: {
script: 'server.js'
},
options: {
ignore: ['node_modules/**'],
}
},
concurrent: {
tasks: ['nodemon', 'watch'],
options: {
logConcurrentOutput: true
}
},
env: {
test: {
NODE_ENV: 'test'
}
},
mochaTest: {
src: ['test/**/*.js'],
options: {
reporter: 'spec',
require: 'server.js'
}
},
emberTemplates: {
options: {
templateName: function(sourceFile) {
var templatePath = config.app + '/ember/templates/';
return sourceFile.replace(templatePath, '');
}
},
dist: {
files: {
'<%= config.app %>/compiled-templates.js': '<%= config.app %>/ember/templates/{,*/}*.hbs'
}
}
},
neuter: {
client: {
options: {
includeSourceMap: true,
filepathTransform: function(filepath) {
return 'public/' + filepath;
}
},
src: '<%= config.app %>/ember/app.js',
dest: '<%= config.app %>/combined-scripts.js'
}
},
replace: {
sourceMap: {
src: '<%= config.app %>/combined-scripts.js.map', // source files array (supports minimatch)
dest: '<%= config.app %>/combined-scripts.js.map', // destination directory or file
replacements: [{
from: 'public/', // string replacement
to: ''
}]
}
},
clean: {
server: '.tmp'
}
});
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
//Load NPM tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-env');
//Making grunt default to force in order not to break the project.
grunt.option('force', true);
//Default task(s).
grunt.registerTask('default', [
'clean:server',
'compass:server',
'neuter:client',
'replace:sourceMap',
'emberTemplates',
'concurrent'
]);
//Test task.
grunt.registerTask('test', ['env:test', 'mochaTest']);
};