-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
134 lines (116 loc) · 2.87 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
vendorScriptFiles: [
'vendor/angular/angular.min.js',
'vendor/ngSmoothScroll/angular-smooth-scroll.min.js',
'vendor/wowjs/dist/wow.min.js',
'vendor/angular-simple-logger/dist/angular-simple-logger.js',
'vendor/ui-leaflet/dist/ui-leaflet.js'
],
personalScriptFiles: [
'public/js/main.js',
'public/js/minHeightDirective.js'
],
stylesheetFiles:[
'vendor/bootstrap/dist/css/bootstrap.min.css',
'vendor/bootstrap/dist/css/bootstrap-theme.min.css',
'vendor/animate.css/animate.min.css',
'vendor/leaflet/dist/leaflet.css'
],
jshint: {
options: {
reporter: require('jshint-stylish')
},
build: ['Gruntfile.js', 'public/js/**/*.js']
},
clean: {
dist: {
src: 'dist'
},
css: {
src: 'public/css/*.css'
}
},
copy: {
dist: {
cwd: 'public',
src: ['**/*', '!vendor/**/*', '!js/**/*.js','!**/less/*.less', '<%= vendorScriptFiles %>', '<%= stylesheetFiles %>'],
dest: 'dist',
expand: true
}
},
cssmin: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd hh-MM-ss") %> */\n',
sourceMap: false
},
dist: {
files: {
'dist/css/<%= pkg.name %>.min.css' : ['dist/css/<%= pkg.name %>.css']
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd hh-MM-ss") %> */',
sourceMap: false,
mangle: false
},
dist: {
src: ['<%= personalScriptFiles %>'],
dest: 'dist/js/<%= pkg.name %>.min.js'
}
},
htmlbuild: {
dist: {
src: 'public/index.html',
dest: 'dist',
relative: true,
options: {
beautify: false,
relative: true,
logOptions: true,
scripts: {
bundle: {
cwd: 'dist',
files: ['<%= vendorScriptFiles %>', 'js/<%= pkg.name %>.min.js']
}
},
styles: {
bundle: ['dist/css/<%= pkg.name %>.min.css']
}
}
},
},
less: {
build: {
src: 'public/less/<%= pkg.name %>.less',
dest: 'public/css/<%= pkg.name %>.css'
}
},
watch: {
options: {
livereload: true
},
stylesheets: {
files: 'public/less/*.less',
tasks: ['clean:css', 'less:build']
},
scripts: {
files: ['Gruntfile.js', 'public/js/**/*.js'],
tasks: ['jshint:build']
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-html-build');
grunt.registerTask('default',['watch']);
grunt.registerTask('dist', ['jshint:build','less:build', 'clean:dist', 'copy:dist', 'uglify:dist','cssmin:dist', 'htmlbuild:dist' ]);
};