Skip to content

Commit

Permalink
Merge pull request #111 from sethkinast/amd
Browse files Browse the repository at this point in the history
Add AMD support
  • Loading branch information
prashn64 committed Mar 3, 2015
2 parents f29a283 + 77ccacd commit 615899b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"dust": true,
"require": true,
"module": true,
"define": true,
"console": true,
"__dirname": true
}
}
}
18 changes: 12 additions & 6 deletions lib/dust-helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
(function(dust){
(function(root, factory) {
if (typeof define === 'function' && define.amd && define.amd.dust === true) {
define(['dust.core'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('dustjs-linkedin'));
} else {
factory(root.dust);
}
}(this, function(dust) {

// Use dust's built-in logging when available
var _log = dust.log ? function(msg, level) {
Expand Down Expand Up @@ -611,12 +619,10 @@ var helpers = {

};

for (var key in helpers) {
for(var key in helpers) {
dust.helpers[key] = helpers[key];
}

if(typeof exports !== 'undefined') {
module.exports = dust;
}
return dust;

})(typeof exports !== 'undefined' ? require('dustjs-linkedin') : dust);
}));

0 comments on commit 615899b

Please sign in to comment.