-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
125 lines (122 loc) · 3.94 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
module.exports = function(grunt) {
require('time-grunt')(grunt);
// load npmTasks which named with pattern 'grunt-*' and 'grunt-contrib-*'
require('grunt-task-loader')(grunt, {
/* see issue https://github.com/yleo77/grunt-task-loader/issues/1 */
mapping: {
cachebreaker: 'grunt-cache-breaker',
ngAnnotate: 'grunt-ng-annotate'
}
});
// project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/* ========== Tasks ===========*/
watch: {
gruntfile: {
files: ['Gruntfile.js'],
options: {
reload: true
}
},
sass: {
files: ['scss/**/*.scss'],
tasks: ['sass:dev', 'sass:publish']
},
leaf: {
files: ['www/js/leaf/*.js'],
tasks: ['clean:leaf', 'concat:leaf']
},
livereload: {
options: { livereload: 35729 },
files: 'www/**/*'
},
},
connect: {
dev: {
options: {
hostname: '0.0.0.0',
port: 9000,
open: false,
livereload: 35729,
base: '.',
middleware: function(connect, options, middlewares) {
return [connect.static('./www')];
}
}
}
},
clean: {
css: ['www/css/*.css'],
leaf: ['www/js/leaf.js']
},
concat: {
leaf: {
src: ['www/js/leaf/intro.js',
'www/js/vendors/angular.min.js',
'www/js/vendors/iscroll-probe.js',
'www/js/vendors/swiper.min.js',
'www/js/leaf/leafUi.js',
'www/js/leaf/leafUltis.js',
'www/js/leaf/leaf.js',
'www/js/leaf/outro.js'],
dest: 'www/js/leaf.js',
}
},
ngAnnotate: {
options: {
singleQuotes: true
},
leaf: {
files: {
'www/js/leaf.annotated.js': ['www/js/leaf.js']
}
}
},
uglify: {
options: {
banner: "/**\n ** leaf-angular\n **A ui framework based on angularjs\n ** http://maple-leaf.github.io/leaf-angular\n ** Copyright 2015, maple-leaf\n ** Email: [email protected]/[email protected]\n ** Licensed under MIT\n*/\n"
},
leaf: {
files: {
'www/js/leaf.min.js': ['www/js/leaf.annotated.js']
}
}
},
copy: {
},
sass: {
dev: {
options: {
style: 'expanded',
sourcemap: 'none',
lineNumbers: true
},
files: [{
expand: true,
cwd: 'scss',
src: ['*.scss', 'leaf/leaf.scss'],
dest: 'www/css',
ext: '.css',
}]
},
publish: {
options: {
style: 'compressed',
sourcemap: 'none',
lineNumbers: false
},
files: [{
expand: true,
cwd: 'scss',
src: ['*.scss', 'leaf/leaf.scss'],
dest: 'www/css',
ext: '.min.css',
}]
}
}
});
// grunt task registration
grunt.registerTask('default', ['clean', 'connect:dev', 'sass:dev', 'sass:publish', 'concat:leaf', 'watch']);
grunt.registerTask('publish', ['sass:publish', 'concat:leaf', 'ngAnnotate', 'uglify']);
};