Skip to content

Commit

Permalink
Changed wrapper to work with Node/CommonJS
Browse files Browse the repository at this point in the history
  • Loading branch information
staaky committed Aug 20, 2015
1 parent 63bd11d commit ca6b283
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 31 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ module.exports = function(grunt) {
process: true
},
src: [
'src/intro.js',
'src/umd-head.js',

// core
'src/voila.js',
'src/imageready.js',

'src/outro.js'
'src/umd-tail.js'
],
dest: 'voila.pkgd.js'
}
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Nick Stakenburg
Copyright (c) 2015 Nick Stakenburg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "voila",
"version": "1.3.1",
"version": "1.4.0",
"description": "A jQuery plugin that provides callbacks for images, letting you know when they've loaded.",
"keywords": [
"image",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "voila",
"title": "Voilà",
"version": "1.3.1",
"title": "Voilà",
"version": "1.4.0",
"description": "A jQuery plugin that provides callbacks for images, letting you know when they've loaded.",
"keywords": [
"image",
Expand Down
17 changes: 0 additions & 17 deletions src/intro.js

This file was deleted.

22 changes: 22 additions & 0 deletions src/umd-head.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*!
* Voilà - v<%= pkg.version %>
* (c) <%= grunt.template.today("yyyy") %> Nick Stakenburg
*
* http://voila.nickstakenburg.com
*
* MIT License
*/

// UMD wrapper
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser global
root.Voila = factory(jQuery);
}
}(this, function($) {
File renamed without changes.
17 changes: 11 additions & 6 deletions voila.pkgd.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
/*!
* Voilà - v1.3.1
* Voilà - v1.4.0
* (c) 2015 Nick Stakenburg
*
* http://voila.nickstakenburg.com
*
* MIT License
*/

// Use AMD or window
;(function(factory) {
// UMD wrapper
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (jQuery && !window.Voila) {
window.Voila = factory(jQuery);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser global
root.Voila = factory(jQuery);
}
}(function($) {
}(this, function($) {

function Voila(elements, opts, cb) {
if (!(this instanceof Voila)) {
Expand Down
4 changes: 2 additions & 2 deletions voila.pkgd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ca6b283

Please sign in to comment.