JulienCabanes / requirejs-tpl

RequireJS Template Plugin
207 stars 43 forks source link

Update to work with require.js version 2.0.0 #2

Closed eeroan closed 12 years ago

eeroan commented 12 years ago

At least is now req.nameToUrl() has changed to req.toUrl(). And for some reason adding 'tpl!navigation.html' throws error "navigation.js" not found!

ZeeAgency commented 12 years ago

Thanks for the feedback ! Actually I didn't test yet with Require.js 2. Sad thing if the API is broken... I'll fix it ASAP.

ZeeAgency commented 12 years ago

This should help :) I've tested really quick with the demo and it seems OK. Btw, may I know the project, if public, where you're using this plugin ? Thanks again !

eeroan commented 12 years ago

Working great! That was fast!

I have bunch of helper functions that are used on templates. Could they be somehow available for templates implicitly? Instead of saying:

myTemplate(_.extend(helperFunctions, {name: 'john'})

I would like to just say:

myTemplate({name: 'john'})

I don't want to put them in global namespace either. Any suggestions for having some configuration hook?

ZeeAgency commented 12 years ago

Nice feature request actually, I have the same needs currently and didn't took the time to make it. I'll see what I can do :)

eeroan commented 12 years ago

Perhaps having tplHelpers in config could be the right way of passing the default helpers for templates?

require.config({ tplHelpers: {formattedDate: function(date) {...}} })