forked from FirebaseExtended/firechat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
96 lines (84 loc) · 2.39 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
module.exports = function(grunt) {
"use strict";
// Initializes the Grunt tasks with the following settings
grunt.initConfig({
// A list of files which will be syntax-checked by JSHint.
jshint: {
files: ['src/js/shims.js', 'src/js/firechat.js', 'src/js/firechat-ui.js'],
options: {
regexdash: false
}
},
// Precompile templates and strip whitespace with 'processContent'.
jst: {
compile: {
options: {
path: 'templates',
namespace: 'FirechatDefaultTemplates',
prettify: true,
processContent: function(src) {
return src.replace(/(^\s+|\s+$)/gm, '');
}
},
files: {
'compiled/templates.js': ['templates/*.html']
}
}
},
// Compile and minify LESS CSS for production.
less: {
development: {
files: {
"dist/firechat.css": "src/less/styles.less"
}
},
production: {
options: {
yuicompress: true
},
files: {
"dist/firechat.min.css": "src/less/styles.less"
}
}
},
// Concatenate files in a specific order.
concat: {
js: {
src: [
'src/js/libs/underscore-1.7.0.min.js',
'compiled/templates.js',
'src/js/shims.js',
'src/js/firechat.js',
'src/js/firechat-ui.js'
],
dest: 'dist/firechat.js'
}
},
// Minify concatenated files.
uglify: {
dist: {
src: ['<%= concat.js.dest %>'],
dest: 'dist/firechat.min.js'
}
},
// Clean up temporary files.
clean: ['compiled/'],
// Tasks to execute upon file change when using `grunt watch`.
watch: {
src: {
files: ['src/**/*.*', 'templates/**/*.*'],
tasks: ['default']
}
}
});
// Load specific plugins, which have been installed and specified in package.json.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task operations if simply calling `grunt` without options.
grunt.registerTask('default', ['jshint', 'jst', 'less', 'concat', 'uglify', 'clean']);
};