forked from mailru/FileAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
124 lines (108 loc) · 3.09 KB
/
Gruntfile.js
File metadata and controls
124 lines (108 loc) · 3.09 KB
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
'use strict';
module.exports = function (grunt){
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
'Gruntfile.js'
, 'lib/**/*.js'
, 'plugins/jquery.fileapi.js'
],
options: {
curly: true // + "Expected '{' and instead saw 'XXXX'."
, immed: true
, latedef: true
, newcap: true // "Tolerate uncapitalized constructors"
, noarg: true
, sub: true
, undef: true
, unused: true
, boss: true
, eqnull: true
, node: true
, es5: true
, expr: true // - "Expected an assignment or function call and instead saw an expression."
, supernew: true // - "Missing '()' invoking a constructor."
, laxcomma: true
, laxbreak: true
, smarttabs: true
}
},
version: {
src: 'lib/FileAPI.core.js'
},
qunit: {
options: {
files: {
'1px.gif': ['tests/files/1px.gif']
, 'hello.txt': ['tests/files/hello.txt']
, 'image.jpg': ['tests/files/image.jpg']
, 'dino.png': ['tests/files/dino.png']
, 'multiple': ['tests/files/1px.gif', 'tests/files/hello.txt', 'tests/files/image.jpg', 'tests/files/dino.png', 'tests/files/lebowski.json']
}
},
all: ['tests/*.html']
},
concat: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> - <%= pkg.license %> | <%= pkg.repository.url %>\n' +
' * <%= pkg.description %>\n' +
' */\n\n',
footer: 'if( typeof define === "function" && define.amd ){ define("FileAPI", [], function (){ return FileAPI; }); }'
},
all: {
src: [
'lib/canvas-to-blob.js'
, 'lib/FileAPI.core.js'
, 'lib/FileAPI.Image.js'
, 'lib/load-image-ios.js'
, 'lib/FileAPI.Form.js'
, 'lib/FileAPI.XHR.js'
, 'lib/FileAPI.Camera.js'
, 'lib/FileAPI.Flash.js'
],
dest: 'dist/<%= pkg.name %>.js'
},
html5: {
src: [
'lib/canvas-to-blob.js'
, 'lib/FileAPI.core.js'
, 'lib/FileAPI.Image.js'
, 'lib/load-image-ios.js'
, 'lib/FileAPI.Form.js'
, 'lib/FileAPI.XHR.js'
, 'lib/FileAPI.Camera.js'
],
dest: 'dist/<%= pkg.name %>.html5.js'
}
},
uglify: {
options: { banner: '/*! <%= pkg.name %> <%= pkg.version %> - <%= pkg.license %> | <%= pkg.repository.url %> */\n' },
dist: {
files: {
'dist/<%= pkg.name %>.min.js': ['<%= concat.all.dest %>']
, 'dist/<%= pkg.name %>.html5.min.js': ['<%= concat.html5.dest %>']
}
}
},
watch: {
scripts: {
files: 'lib/**/*.js',
tasks: ['concat'],
options: { interrupt: true }
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-version');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
// Load custom QUnit task, based on grunt-contrib-qunit, but support "files" option.
grunt.loadTasks('./tests/grunt-task/');
// "npm build" runs these tasks
grunt.registerTask('build', ['version', 'concat', 'uglify', 'qunit']);
grunt.registerTask('default', ['jshint', 'build']);
};