Skip to content

Instantly share code, notes, and snippets.

@blissdev
Created March 31, 2012 11:10
Show Gist options
  • Save blissdev/2262214 to your computer and use it in GitHub Desktop.
Save blissdev/2262214 to your computer and use it in GitHub Desktop.
require-handlebars-plugin issue
/* START_TEMPLATE */
define(['hbs','Handlebars'], function( hbs, Handlebars ){
var t = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
helpers = helpers || Handlebars.helpers;
var buffer = "", self=this;
buffer += "\n<li class=\"you\">You</li>\n";
return buffer;});
Handlebars.registerPartial('_assets_scripts_resident_templates_you', t);
t.meta = {
"name" : "you"
};
t.helpers = [];
t.deps = [];
t.vars = [];
return t;
});
/* END_TEMPLATE */
//@ sourceURL=/assets/scripts/resident/templates/you.hbs?bust=2
<script>
require(
{
baseUrl: '/assets/scripts',
urlArgs: 'bust=' + '2',
paths: {
'hbs': 'vendor/hbs',
'Handlebars': 'vendor/handlebars/handlebars',
'Handlebars/i18nprecompile': 'vendor/handlebars/i18nprecompile',
underscore: 'vendor/underscore',
'json2': 'vendor/handlebars/json2'
}
},
['shared/global', 'resident/global', 'resident/<?= isset($script) ? $script : 'default'; ?>']
);
</script>
require.config({
hbs: {
templateExtension: 'hbs',
disableI18n: true
}
});
define([
'resident/helper/rooms/layout',
'/assets/scripts/vendor/backbone.js',
'/assets/scripts/vendor/raphael.js',
'/assets/scripts/vendor/json2.js',
'/assets/scripts/vendor/handlebars.js',
'/assets/scripts/vendor/ui.js',
'hbs!/assets/scripts/resident/templates/you'
], function(Layout, tmplYou) {
// application code
console.log( tmplYou ); // returns null
});
{{!
{
"name" : "You"
}
}}
<li class="you">You</li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment