-
Notifications
You must be signed in to change notification settings - Fork 47
/
Gruntfile.js
92 lines (85 loc) · 2.7 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
'use strict';
module.exports = function (grunt) {
grunt.initConfig({
jshint: {
files: ['controllers/**/*.js', 'lib/**/*.js', 'models/**/*.js'],
options: {
jshintrc: '.jshintrc'
}
},
requirejs: {
compile: {
options: {
baseUrl: 'public/js',
mainConfigFile: 'public/js/app.js',
dir: '.build/js',
optimize: 'uglify',
modules: [{name: 'app'}]
}
}
},
less: {
compile: {
options: {
yuicompress: true,
paths: ['public/css']
},
files: {
'.build/css/app.css': 'public/css/app.less'
}
}
},
makara: {
files: ['public/templates/**/*.dust'],
options: {
contentPath: ['locales/**/*.properties']
}
},
dustjs: {
compile: {
files: [
{
expand: true,
cwd: 'tmp/',
src: '**/*.dust',
dest: '.build/templates',
ext: '.js'
}
],
options: {
fullname: function (filepath) {
var path = require('path'),
name = path.basename(filepath, '.dust'),
parts = filepath.split(path.sep),
fullname = parts.slice(3, -1).concat(name);
return fullname.join(path.sep);
}
}
}
},
clean: {
'tmp': 'tmp',
'build': '.build/templates'
},
mochacli: {
src: ['test/*.js'],
options: {
globals: ['chai'],
timeout: 6000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'spec'
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-cli');
grunt.loadNpmTasks('grunt-dustjs');
grunt.loadTasks('./node_modules/makara/tasks/');
grunt.registerTask('i18n', ['clean', 'makara', 'dustjs', 'clean:tmp']);
grunt.registerTask('build', ['jshint', 'less', 'requirejs', 'i18n']);
grunt.registerTask('test', ['jshint', 'mochacli', 'clean:tmp']);
};