-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathGruntfile.js
96 lines (87 loc) · 2.74 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) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
livereloadx: {
dir: 'src/main/webapp/',
proxy: 'http://localhost:8080/',
preferLocal: true,
liveCSS: true,
liveImg: true,
},
gruntfile: {
src: 'Gruntfile.js'
},
bower_concat: {
all: {
dest: 'src/main/webapp/dist/lib.js',
bowerOptions: {
relative: false
},
exclude: [
'font-awesome', 'overthrow'
]
}
},
concat: {
dist: {
src: [
'src/main/webapp/js/*.js',
'src/main/webapp/js/controllers/*.js'// This specific file
],
dest: 'src/main/webapp/dist/app.js'
}
},
uglify: {
build: {
src: ['src/main/webapp/dist/app.js', 'src/main/webapp/dist/lib.js'],
dest: 'src/main/webapp/dist/app.min.js'
}
},
less: {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: {
// target.css file: source.less file
"src/main/webapp/dist/main.css": "src/main/webapp/css/main.less"
}
}
},
watch: {
html: {
files: ['src/main/webapp/index.html', 'src/main/webapp/partials/*.html'],
options: {
nospawn: true
}
},
scripts: {
files: ['src/main/webapp/js/*.js', 'src/main/webapp/js/controllers/*.js'],
tasks: ['concat'],
options: {
spawn: false,
},
},
styles: {
tasks: ['less'],
files: ['src/main/webapp/css/*.less'],
options: {
nospawn: true
}
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-bower-concat');
grunt.loadNpmTasks('livereloadx');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', ['concat', 'bower_concat', 'uglify', 'less']);
grunt.registerTask('server', ['concat', 'bower_concat', 'less', 'livereloadx', 'watch']);
};