-
Notifications
You must be signed in to change notification settings - Fork 18
/
Gruntfile.js
183 lines (163 loc) · 3.7 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*global module, require*/
module.exports = function (grunt) {
'use strict';
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Define the configuration for all the tasks
grunt.initConfig({
// Project settings
config: {
src: 'src',
dist: 'dist',
gh: 'gh-pages',
tmp: '.tmp'
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= config.dist %>/**/*'
]
}]
},
gh: {
files: [{
dot: true,
src: [
'<%= config.gh %>'
]
}]
}
},
// A multi-task to validate your JavaScript files with JSLint.
jslint: {
scripts: {
src: ['<%= config.src %>/ng-rateit.js'],
directives: {
predef: ['angular','document','window','console'],
white: true,
regexp: true,
newcap: true,
todo: true
}
}
},
removelogging: {
dist: {
src: "<%= config.src %>/ng-rateit.js",
dest: "<%= config.dist %>/ng-rateit.js"
}
},
// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
dist: {
files: [{
expand: true,
src: '<%= config.dist %>/ng-rateit.js',
dest: ''
}]
}
},
// Minify files with UglifyJS.
uglify: {
build: {
files: {
'<%= config.dist %>/ng-rateit.min.js': ['<%= config.dist %>/ng-rateit.js']
}
}
},
// This task converts all data found within a stylesheet (those within a url( ... ) declaration)
// into base64-encoded data URI strings. This includes images and fonts.
imageEmbed: {
dist: {
src: [ "<%= config.src %>/style/ng-rateit.css" ],
dest: "<%= config.dist %>/ng-rateit.css",
options: {
deleteAfterEncoding : false
}
}
},
// The following *-min tasks will produce minified files in the dist folder
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
cssmin: {
dist: {
files: {
'<%= config.dist %>/ng-rateit.css': [
'<%= config.dist %>/ng-rateit.css'
]
}
}
},
copy:{
gh:{
files: [
{
cwd: 'example',
src: '**/*',
dest: '<%= config.gh %>',
expand: true
},
{
src: ['dist/**/*'],
dest: '<%= config.gh %>/'
}
]
}
},
replace: {
gh: {
options: {
usePrefix:false,
patterns: [
{
match: '../',
replacement: ''
}
]
},
files: [
{src: ['<%= config.gh %>/index.html'], dest: '<%= config.gh %>/index.html'}
]
}
},
'gh-pages': {
options: {
base: 'gh-pages',
message: 'Auto-generated commit'
},
src: ['**']
},
version: {
project: {
src: ['package.json', 'bower.json']
}
}
});
grunt.registerTask('build', [
'clean:dist',
'jslint',
'removelogging',
'ngAnnotate',
'uglify',
'imageEmbed',
'cssmin'
]);
grunt.registerTask('deploy-patch', [
'version::patch',
'ghpage'
]);
grunt.registerTask('ghpage', [
'build',
'clean:gh',
'copy:gh',
'replace:gh',
'gh-pages',
'clean:gh',
]);
};