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

Commit

Permalink
Add UMD wrapper, and remove separate AMD version
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebuilds committed Apr 16, 2014
1 parent abc1bd1 commit 0947ab8
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 43 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Expand Up @@ -20,6 +20,7 @@
"Wreqr": true,
"require": true,
"module": true,
"define": true
"define": true,
"exports": true
}
}
19 changes: 5 additions & 14 deletions Gruntfile.js
Expand Up @@ -6,14 +6,14 @@ module.exports = function(grunt) {
pkg: grunt.file.readJSON('package.json'),
meta: {
version: '<%= pkg.version %>',
banner:
banner:
'// Backbone.Wreqr (Backbone.Marionette)\n' +
'// ----------------------------------\n' +
'// ----------------------------------\n' +
'// v<%= pkg.version %>\n' +
'//\n' +
'//\n' +
'// Copyright (c)<%= grunt.template.today("yyyy") %> Derick Bailey, Muted Solutions, LLC.\n' +
'// Distributed under MIT license\n' +
'//\n' +
'//\n' +
'// http://github.com/marionettejs/backbone.wreqr\n' +
'\n\n'
},
Expand All @@ -27,12 +27,7 @@ module.exports = function(grunt) {
files: {
'lib/backbone.wreqr.js' : 'src/wreqr.js'
}
},
core_amd: {
files: {
'lib/amd/backbone.wreqr.js' : 'src/amd.js'
}
},
}
},

concat: {
Expand All @@ -49,10 +44,6 @@ module.exports = function(grunt) {
options: {
banner: "<%= meta.banner %>"
},
amd : {
src : 'lib/amd/backbone.wreqr.js',
dest : 'lib/amd/backbone.wreqr.min.js'
},
core : {
src : 'lib/backbone.wreqr.js',
dest : 'lib/backbone.wreqr.min.js',
Expand Down
4 changes: 2 additions & 2 deletions component.json
Expand Up @@ -28,8 +28,8 @@
"jashkenas/backbone": "*",
"jashkenas/underscore": "*"
},
"main": "lib/amd/backbone.wreqr.js",
"main": "lib/backbone.wreqr.js",
"scripts": [
"lib/amd/backbone.wreqr.js"
"lib/backbone.wreqr.js"
]
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -3,7 +3,7 @@
"description": "A Simple Service Bus For Backbone and Backbone.Marionette",
"version": "1.2.0",
"homepage": "https://github.com/marionettejs/backbone.wreqr",
"main": "lib/amd/backbone.wreqr.js",
"main": "lib/backbone.wreqr.js",
"keywords": [
"backbone",
"plugin",
Expand Down
21 changes: 0 additions & 21 deletions src/amd.js

This file was deleted.

22 changes: 18 additions & 4 deletions src/wreqr.js
@@ -1,6 +1,21 @@
Backbone.Wreqr = (function(Backbone, Marionette, _){
(function(root, factory) {

if (typeof define === 'function' && define.amd) {
define(['exports', 'backbone', 'underscore'], function(exports, Backbone, _) {
factory(exports, Backbone, _);
});
} else if (typeof exports !== 'undefined') {
var Backbone = require('backbone');
var _ = require('underscore');
factory(exports, Backbone, _);
} else {
factory({}, root.Backbone, root._);
}

}(this, function(Wreqr, Backbone, _) {
"use strict";
var Wreqr = {};

Backbone.Wreqr = Wreqr;

// @include wreqr.handlers.js
// @include wreqr.commandStorage.js
Expand All @@ -10,5 +25,4 @@ Backbone.Wreqr = (function(Backbone, Marionette, _){
// @include wreqr.channel.js
// @include wreqr.radio.js

return Wreqr;
})(Backbone, Backbone.Marionette, _);
}));

0 comments on commit 0947ab8

Please sign in to comment.