Where does NodeBB compile templates?
-
Let's pretend that templates.js doesn't always perfectly manage caching of templates.
Where does it compile templates to? Could I essentially wipe the compiled templates folder and ./nodebb start again and it'd compile?
P.S. Wouldn't it be cool if ./nodebb could take a second parameter of 'clean'?
./nodebb dev clean
./nodebb start cleanWouldn't it be magic?
-
Yup. And it isn't tjs that does this, its NodeBB. We'll be moving stuff like this into grunt eventually
-
@psychobunny I prefer Gulp myself.
-
Gulp is cool too, but right now we have some decent amount of technical debt having built LESS compilation and JS minification into NodeBB itself as opposed to using Grunt / Gulp etc. So stay tuned to https://github.com/NodeBB/NodeBB/issues/3543 we'll be trying to cut down on this towards 1.0
-
What does that code actually do?
I'm trying to figure this out because I'm working on a template system myself. To me, comparing compiled templates to uncompiled ones, it looks like this compilation doesn't really do much at all. Wouldn't a better compilation system compile templates into executable functions?
-
@julian that's way simpler than I thought the compilation was doing, although the code makes sense now (comments help with that, too )
@psychobunny should really get working on compiling templates into JavaScript functions. It would probably speed up your rendering fairly significantly.
String#replace is actually a very slow operation compared to concatenation.
-
Yeah its on my todo for tjs 1.0