forked from willdurand/TravisLight
/
grunt.js
85 lines (81 loc) · 2.54 KB
/
grunt.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
/*global module:false*/
module.exports = function(grunt) {
"use strict";
var jsFiles = [
'js/*.js',
'js/collections/*.js',
'js/models/*.js',
'js/views/*.js',
'test/*.js',
'test/**/*.js'
];
// Project configuration.
grunt.initConfig({
lint: {
files: jsFiles
},
requirejs: {
compile: {
options: {
name: "main",
baseUrl: "js/",
mainConfigFile: "js/main.js",
out: "dist/compiled.js"
}
}
},
mincss: {
compress: {
files: {
'dist/compiled.css': [
'css/bootstrap.min.css',
'dist/application-embed.css'
]
}
}
},
imageEmbed: {
application: {
src: 'css/application.css',
dest: 'dist/application-embed.css',
deleteAfterEncoding : false
}
},
clean: {
css: [ 'dist/application-embed.css' ],
dist: [ 'dist/' ]
},
mocha: {
all: [ 'test/index.html' ]
},
targethtml: {
dist: {
src: 'index.html',
dest: 'dist/index.html'
}
},
copy: {
dist: {
files: {
'dist/js/require.js': 'components/requirejs/require.js',
'dist/font-awesome/css/': 'components/font-awesome/css/*.css',
'dist/font-awesome/font/': 'components/font-awesome/font/*',
'dist/font-awesome/FontAwesome.ttf': 'components/font-awesome/FontAwesome.ttf',
'dist/favicon.ico': 'favicon.ico'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-mincss');
grunt.loadNpmTasks('grunt-image-embed');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-targethtml');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('package', 'clean:dist compile:js compile:css compile:html copy:dist');
grunt.registerTask('compile:js', 'requirejs');
grunt.registerTask('compile:css', 'imageEmbed mincss clean:css');
grunt.registerTask('compile:html', 'targethtml:dist');
grunt.registerTask('test', 'lint mocha');
};