forked from danialfarid/ng-file-upload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
94 lines (89 loc) · 2.18 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
module.exports = function(grunt) {
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
copy : {
build : {
options : {
processContent : function(content, srcpath) {
return grunt.template.process(content);
}
},
files : [ {
expand : true,
cwd : 'demo/war/js/',
src : '<%= pkg.name %>*.js',
dest : 'dist/',
flatten : true,
filter : 'isFile'
}]
},
fileapi: {
files: [{
expand : true,
cwd : 'demo/war/js/',
src : 'FileAPI.flash.swf',
dest : 'dist/',
flatten : true,
filter : 'isFile'
}, {
expand : true,
cwd : 'demo/war/js/',
src : 'FileAPI.min.js',
dest : 'dist/',
flatten : true,
filter : 'isFile'
} ]
},
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'
} ]
}
},
uglify : {
options : {
banner : '/*! <%= pkg.version %> */\n'
},
build : {
files : [ {
'dist/<%= pkg.name %>.min.js' : 'dist/<%= pkg.name %>.js',
'dist/<%= pkg.name %>-shim.min.js' : 'dist/<%= pkg.name %>-shim.js',
'dist/<%= pkg.name %>-html5-shim.min.js' : 'dist/<%= pkg.name %>-html5-shim.js'
} ]
}
},
replace : {
version : {
src: ['nuget/Package.nuspec', '../angular-file-upload-bower/bower.json',
'../angular-file-upload-shim-bower/bower.json', 'aaaa.txt'
],
overwrite: true,
replacements: [{
from: /"version" *: *".*"/g,
to: '"version": "<%= pkg.version %>"'
}, {
from: /<version>.*<\/version>/g,
to: '<version><%= pkg.version %></version>'
}]
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-text-replace');
// Default task(s).
grunt.registerTask('default', [ 'copy:build', 'uglify', 'copy:fileapi', 'copy:bower', 'replace:version' ]);
};