forked from danialfarid/ng-file-upload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
128 lines (123 loc) · 3.21 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
'use strict';
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
all: {
options: {
process: function (content) {
return grunt.template.process(content);
}
},
files: {
'dist/ng-file-upload.js': ['src/upload.js', 'src/model.js', 'src/select.js', 'src/data-url.js',
'src/validate.js', 'src/resize.js', 'src/drop.js', 'src/exif.js'],
'dist/ng-file-upload-shim.js': ['src/shim-upload.js', 'src/shim-elem.js', 'src/shim-filereader.js'],
'dist/ng-file-upload-all.js': ['dist/ng-file-upload-shim.js', 'dist/ng-file-upload.js']
}
}
},
uglify: {
options: {
preserveComments: 'some',
banner: '/*! <%= pkg.version %> */\n'
},
build: {
files: [{
'dist/ng-file-upload.min.js': 'dist/ng-file-upload.js',
'dist/ng-file-upload-shim.min.js': 'dist/ng-file-upload-shim.js',
'dist/ng-file-upload-all.min.js': 'dist/ng-file-upload-all.js',
'dist/FileAPI.min.js': 'dist/FileAPI.js'
}]
}
},
copy: {
build: {
files: [{
expand: true,
cwd: 'dist/',
src: '*',
dest: 'demo/src/main/webapp/js/',
flatten: true,
filter: 'isFile'
}]
},
fileapi: {
files: {
'dist/FileAPI.flash.swf': 'src/FileAPI.flash.swf',
'dist/FileAPI.js': 'src/FileAPI.js'
}
},
bower: {
files: [{
expand: true,
cwd: 'dist/',
src: '*',
dest: '../angular-file-upload-bower/',
flatten: true,
filter: 'isFile'
}, {
expand: true,
cwd: 'dist/',
src: '*',
dest: '../angular-file-upload-shim-bower/',
flatten: true,
filter: 'isFile'
}]
}
},
serve: {
options: {
port: 9000
},
'path': 'demo/src/main/webapp'
},
watch: {
js: {
files: ['src/{,*/}*.js'],
tasks: ['jshint:all', 'concat:all', 'copy:build']
}
},
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js',
'src/{,*/}*.js',
'!src/FileAPI*.*',
'test/spec/{,*/}*.js'
]
},
replace: {
version: {
src: ['nuget/Package.nuspec'],
overwrite: true,
replacements: [{
from: /"version" *: *".*"/g,
to: '"version": "<%= pkg.version %>"'
}, {
from: /<version>.*<\/version>/g,
to: '<version><%= pkg.version %></version>'
}]
}
},
clean: {
dist: {
files: [{
dot: true,
src: [
'dist',
'!dist/.git*'
]
}]
}
}
});
grunt.registerTask('dev', ['jshint:all', 'concat:all', 'uglify', 'copy:build', 'watch']);
grunt.registerTask('default', ['jshint:all', 'clean:dist', 'concat:all',
'copy:fileapi', 'uglify', 'copy:build', 'copy:bower', 'replace:version']);
};