-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
101 lines (100 loc) · 3.04 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
module.exports = function(grunt){
(require('load-grunt-tasks'))(grunt);
grunt.registerTask('serve',['connect:server']);
grunt.registerTask('build',['clean','bower','concurrent:build']);
grunt.registerTask('default',['build','concurrent:mini']);
grunt.registerTask('all',['bower','default']);
grunt.initConfig({
pkg:grunt.file.readJSON('package.json'),
clean:{
build:{
src:['build/']
}
},
bower: {
install:{
options:{
targetDir: 'build/lib',
cleanTargetDir:true
}
}
},
jshint: {
options: {
reporter: require('jshint-stylish'),
jshintrc: true
},
lint: ['Gruntfile.js', 'src/scripts/**/*.js']
},
cssmin:{
combine:{
files:{
'build/css/lib.min.css': ['build/lib/**/*.css'],
'build/css/all.min.css':['src/**/*.css']
}
}
},
handlebars: {
compile: {
options: {
namespace: 'JST'
},
files: {
'build/js/compiled_templates.js': ['src/templates/**/application.hbs']
}
}
},
uglify:{
options:{
mangle:false,
verbose:true
},
lib:{
files:{
'build/js/lib.min.js':['build/lib/jquery/jquery.js','build/lib/bootstrap/bootstrap.js','build/lib/handlebars/handlebars.js','build/lib/ember/ember.js', 'build/lib/lodash/lodash.compat.js']
}
}
},
concat:{
dist:{
src: ['src/scripts/**/src.js','src/scripts/**/!(src)*.js'],
dest: 'build/js/all.min.js'
}
},
connect: {
server: {
options: {
port: 8000,
keepalive: true,
livereload: true,
base: ['build/html', 'build/js', 'build/css', 'src/', 'src/scripts', 'src/styles']
}
}
},
watch: {
jsfiles: {
files: ['src/scripts/**/*.js'],
tasks: ['jshint']
},
handlebars:{
files: ['src/templates/**/*.hbs'],
tasks:['handlebars']
},
htmlCssJs: {
files: ['src/scripts/**/*.js', 'src/**/*.html', 'src/**/*.css'],
tasks: ['cssmin','concat']
},
options: {
spawn: true,
livereload: true
}
},
concurrent: {
build: ['newer:cssmin', 'newer:uglify', 'newer:handlebars', 'newer:jshint','newer:concat'],
mini: ['serve', 'watch'],
options: {
logConcurrentOutput: true
}
}
});
};