-
-
Save dani-z/6263853 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* RequireJS Ember.Handlebars Plugin v0.1.0 | |
* Copyright 2012, Tim Branyen (@tbranyen) | |
* hbs.js may be freely distributed under the MIT license. | |
*/ | |
define(["ember", "text"], function(Ember) { | |
var hbs = { | |
version: "0.1.0", | |
// Invoked by the AMD builder, passed the path to resolve, the require | |
// function, done callback, and the configuration options. | |
load: function(name, req, load, config) { | |
// Dojo provides access to the config object through the req function. | |
if (!config) { | |
config = require.rawConfig; | |
} | |
var tpl = config.hbs; | |
// Get the text for the template and compile it for Ember. | |
req(["text!" + tpl.prefix + name + "." + tpl.ext], function(contents) { | |
// Use global for now (maybe this?) | |
return load(Ember.Handlebars.compile(contents)); | |
}); | |
} | |
}; | |
return hbs; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment