forked from remluben/laravel-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
113 lines (102 loc) · 3.34 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
102
103
104
105
106
107
108
109
110
111
112
113
module.exports = function(grunt) {
// Initialize the grunt configuration
grunt.initConfig({
// less file compilation and compression
less: {
development: {
options: {
compress: true
},
files: {
'./public/assets/css/frontend.css' : './app/assets/less/frontend.less',
'./public/assets/css/backend.css' : './app/assets/less/backend.less'
}
}
},
// JS file concatenation
concat: {
options: {
separator: ';'
},
javascript: {
src: [
'./app/assets/components/bower/jquery/jquery.min.js',
'./app/assets/components/bower/bootstrap/dist/js/bootstrap.min.js',
'./app/assets/js/frontend.js'
],
dest: './public/assets/js/frontend.js'
},
},
// copy ressources such as fonts, files, images, required by assets to the public directory
copy : {
fonts: {
expand: true,
cwd : './app/assets/components/bower/bootstrap/dist/fonts/',
src: ['*'],
dest: './public/assets/fonts/'
},
js : {
expand: true,
cwd : './app/assets/components/bower/modernizr/',
src: ['modernizr.js'],
dest: './public/assets/js/'
}
},
// JS file obfuscation
uglify: {
options: {
mangle: false // do not change variable names
},
dist: {
files: {
'./public/assets/js/frontend.js' : './public/assets/js/frontend.js'
}
}
},
// run PHP unit tests
phpunit: {
classes: {
dir: 'app/tests/'
},
options: {
bin: 'vendor/bin/phpunit',
colors: true
}
},
// automatically run tasks when changing JS, LESS or PHP files
watch: {
js: {
files: ['./app/assets/js/*.*'],
tasks: ['concat','uglify'],
options: {
livereload: true
}
},
less: {
files: ['./app/assets/less/*.*'],
tasks: ['less'],
options: {
livereload: true
}
},
tests: {
files: [
'app/controllers/*.php',
'app/models/*.php'
],
tasks: ['phpunit']
}
}
});
// Load grunt plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-phpunit');
// Set the default task
grunt.registerTask('default', ['watch']);
// Set an additional initialization task to call before running the application the first time
grunt.registerTask('develop', ['less', 'concat', 'copy', 'watch']);
};