Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Added jquery in umd dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyFagis committed Mar 2, 2015
1 parent 7f18fe4 commit 8dd8bfd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
8 changes: 4 additions & 4 deletions dist/js/dropify.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
define(['jquery'], factory);
} else if (typeof exports === 'object') {
module.exports = factory();
module.exports = factory(require('jquery'));
} else {
root.Dropify = factory();
root.Dropify = factory(root.$);
}
}(this, function() {
}(this, function($) {

var pluginName = "dropify";

Expand Down
19 changes: 16 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,20 @@ var jsDir = 'src/js/',
' * (c) 2015 <%= author.name %> <<%= author.email %>> | <%= author.url %>',
' * =============================================================',
' */\n\n'
].join('\n');
].join('\n'),
umdDeps = {
dependencies: function() {
return [
{
name: '$',
amd: 'jquery',
cjs: 'jquery',
global: '$',
param: '$'
}
];
}
};


var onError = function (err) {
Expand Down Expand Up @@ -48,14 +61,14 @@ gulp.task('sass-prod', function() {
gulp.task('scripts-dev', function() {
return gulp.src([jsDir + '*.js'])
.pipe(gulp.dest(distDir + "/js"))
.pipe($.umd())
.pipe($.umd(umdDeps))
.pipe($.header(banner, meta))
.pipe(gulp.dest(distDir + "/js"));
});
gulp.task('scripts-prod', function() {
return gulp.src([jsDir + '*.js'])
.pipe(gulp.dest(distDir + "/js"))
.pipe($.umd())
.pipe($.umd(umdDeps))
.pipe($.header(banner, meta))
.pipe($.uglify())
.pipe(gulp.dest(distDir + "/js"));
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ <h2>Now</h2>
<input type="file" id="input-file-now" class="dropify" data-default-text="toto dans un bateau" />
<br>
<label for="input-file-custom">You can add a default value!</label>
<input type="file" id="input-file-now-custom-1" class="dropify" data-default-image="https://d13yacurqjgara.cloudfront.net/users/19270/screenshots/1949858/15_pco8.jpg" />
<input type="file" id="input-file-now-custom-1" class="dropify" data-default-image="http://www.elao.com/public/images/jobs-animaux.png" />
<br>
<label for="input-file-custom">You can set the height!</label>
<input type="file" id="input-file-now-custom-2" class="dropify" data-height="500" />
<br>
<label for="input-file-custom">You can combine options!</label>
<input type="file" id="input-file-now-custom-3" class="dropify" data-height="500" data-default-image="https://d13yacurqjgara.cloudfront.net/users/19270/screenshots/1949858/15_pco8.jpg" />
<input type="file" id="input-file-now-custom-3" class="dropify" data-height="500" data-default-image="http://www.elao.com/public/images/jobs-animaux.png" />
</div>
</div>
</div>
Expand Down

0 comments on commit 8dd8bfd

Please sign in to comment.