Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 20 additions & 22 deletions scripts/build-templates/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,32 @@
* License and more information at:
* http://github.com/powmedia/backbone-forms
*/
;(function(root) {

//DEPENDENCIES
//CommonJS
if (typeof exports !== 'undefined' && typeof require !== 'undefined') {
var $ = root.jQuery || root.Zepto || root.ender || require('jquery'),
_ = root._ || require('underscore'),
Backbone = root.Backbone || require('backbone');
}

//Browser
else {
var $ = root.jQuery,
_ = root._,
Backbone = root.Backbone;
(function(root, factory) {

// Set up Backbone.Form appropriately for the environment. Start with AMD.
if (typeof define === 'function' && define.amd) {
define(['backbone', 'underscore', 'jquery', 'exports'], function(Backbone, _, $, exports) {
exports = factory(root, _, Backbone, $);
});

// Next for Node.js or CommonJS. jQuery may not be needed as a module.
} else if (typeof exports !== 'undefined') {
var _ = require('underscore'), Backbone = require('backbone'), $;
try { $ = require('jquery'); } catch(e) {}
module.exports = exports = factory(root, _, Backbone, $);

// Finally, as a browser global.
} else {
root.Backbone.Form = factory(root, root._, root.Backbone, (root.jQuery || root.Zepto || root.ender || root.$));
}

}(this, function(root, _, Backbone, $) {

//SOURCE
{{body}}


//Metadata
Form.VERSION = '{{version}}';


//Exports
Backbone.Form = Form;
if (typeof exports !== 'undefined') exports = Form;

})(window || global || this);
return Form;
}));