i can using google, facebook, twitter sso-plugin on my nodebb forum, my nodebb version is: v1.13.4-5
i found plugin in github not work, anybody have the same issues like me and how can you fix it?
I've done (well, almost) it on my branch of NodeBB -- abstract out templates engine and add support of Jade in addition to templates.js
Actually now it's posible to add more template engines in a similar fasion.
There are glitches of course but in general everything looks good.
In my opinion templates.js is cute but a little too lightweight. And at the same time its syntax is quite verbose and looks like "broken html". But ofcourse I can't just frop it. It do its job good and all currently working code use it.
What I wanted is posibility to use another template engines that won't broke everything.
I can make pull request after some cleanups.
This post is an anounce and invitation to a discussion
Wow! That's quite an accomplishment!
What I've always thought would be a nice implementation would be using different templating engines based on file extension.
.tpl? Templates.js, .hbs? Handlebars... etc
I found that I've overlooked one another problem: helpers.
I naively thought that I can just register helper with all engines and everything will work. Bu it won't. Helpers behaviour variates a lot from one engine to another.
For example, templates.js calls helpers in three different ways.
Handlebars calls their helpers consistently but with its own very special way.
Jade has no special concept of helpers, you may use any functions and call it in any way.
templates.js expects that helper used in codition will return something boolean-like,
handlebars actually has no "conditional" helpers, it uses regular "block" helpers that may decide render child block or not.
So the best I can imagine is register helpers separately for different engines It looks redundant but I don't know can I automagically normalize all that zoo.
Any opinions, suggestions?
Sorry guys, pull request is delayed a little.
Well I'm probably too dramatize.
Large part helpers may be normalized that it will get parameters from current block context by name and returns string. That kind of helpers I believe may be registered for any engine.
All other posibilities and differences have to be solved within helper functions code.
@bogus -- what's the end result of your efforts? PR merged into core?
t.js may have its warts, but I really doubt we'll be replacing it anytime soon
@julian, well, yes. PR merged into core would be greate, this is what PRs for
I understood that temlates.js can't be replaced that easy and I don't know if it really should be replaced. This is why I'm trying not to break it.
For now no templates need to be updated. Any code that uses templates through ajaxify just continue to work. And only code that use templates.js directly may need small update.
What do you think about?
ok, PR was fired
It'd be kinda cool if you can mix and match, so if the extension is
.jade it would compile with Jade, or
.tpl will use tjs. Probably would add some overhead but it's something interesting to consider
It's exactly how it's working! And you still can render it by name like 'categories' without extension.