Skip to content

Commit e869991

Browse files
committed
Adding grunt and processing with jshint and uglify
1 parent b701719 commit e869991

File tree

5 files changed

+53
-18
lines changed

5 files changed

+53
-18
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
.DS_Store
1+
.DS_Store
2+
3+
# Node Files
4+
/node_modules/
5+
npm-debug.log
6+
bower_components

Gruntfile.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = function(grunt)
2+
{
3+
// Project configuration.
4+
grunt.initConfig({
5+
pkg: grunt.file.readJSON('package.json'),
6+
uglify: {
7+
options: {
8+
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
9+
},
10+
build: {
11+
src: 'jquery-fileupload.js',
12+
dest: 'jquery-fileupload.min.js'
13+
}
14+
},
15+
jshint: {
16+
files: ['gruntfile.js', 'jquery-fileupload.js'],
17+
options: {
18+
globals: {
19+
jQuery: true,
20+
console: true,
21+
module: true
22+
}
23+
}
24+
}
25+
});
26+
27+
grunt.loadNpmTasks('grunt-contrib-uglify');
28+
grunt.loadNpmTasks('grunt-contrib-jshint');
29+
30+
grunt.registerTask('default', 'build');
31+
grunt.registerTask('build', ['jshint', 'uglify']);
32+
};

jquery-fileupload.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
this.element = element;
3434
this.$form = $(element);
3535
this.$uploaders = $('input[type=file]', this.element);
36-
this.files = {},
36+
this.files = {};
3737
this.settings = $.extend({}, defaults, options);
3838
this._defaults = defaults;
3939
this._name = pluginName;
@@ -114,7 +114,7 @@
114114
processData: false, // Don't process the files, we're using FormData
115115
contentType: false, // Set content type to false as jQuery will tell the server its a query string request
116116
success: function(data, textStatus, jqXHR){ self.processSubmit(event, data); },
117-
error: function(jqXHR, textStatus, errorThrown){ self.settings.error(jqXHR, textStatus, errorThrown) }
117+
error: function(jqXHR, textStatus, errorThrown){ self.settings.error(jqXHR, textStatus, errorThrown); }
118118
}, self.settings.uploadOptions));
119119
},
120120

@@ -162,8 +162,8 @@
162162
cache: false,
163163
dataType: 'json',
164164
success: function(data, textStatus, jqXHR){ self.settings.success(data, textStatus, jqXHR); },
165-
error: function(jqXHR, textStatus, errorThrown){ self.settings.error(jqXHR, textStatus, errorThrown) },
166-
complete: function(jqXHR, textStatus){ self.settings.complete(jqXHR, textStatus) }
165+
error: function(jqXHR, textStatus, errorThrown){ self.settings.error(jqXHR, textStatus, errorThrown); },
166+
complete: function(jqXHR, textStatus){ self.settings.complete(jqXHR, textStatus); }
167167
}, self.settings.submitOptions));
168168
}
169169
};

jquery-fileupload.min.js

+2-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "jQuery-Ajax-File-Upload",
3+
"version": "0.1.0",
4+
"devDependencies": {
5+
"grunt": "~0.4.1",
6+
"grunt-contrib-jshint": "~0.7.2",
7+
"grunt-contrib-uglify": "~0.2.7"
8+
}
9+
}

0 commit comments

Comments
 (0)