Hey all,
Here at Obvious we're using the Closure Compiler (via
Plovr) and parts of the Library on the web client. The frontend server is node.js and we have no plans of using Closure there for the foreseeable future.
To date we've been using
Hogan.js for templating, on both the client and the server, but we decided that we wanted a richer templating language and due to the great integration into the client stack Closure Templates seemed like a logical way to go (also given my previous experience I am obviously slightly biassed).
We couldn't find a simple way to share the templates with our node server, however, so we put together this little library that wraps SoyToJsSrcCompiler.
It allows you to compile and load .soy files without an intermediary build step and has support for dynamic re-compilation. However, for production mode—depending on your deployment environment—I would advise pre-compiling the templates and loading the .soy.js via loadCompiledTemplates so you don't need to ship the jar around and invoke java from the prod machines.
I'd really like to find a way to sandbox the generated functions from the rest of the Node environment without a re-writing step. I got it working using vm.runInContext but the latency was several orders of magnitude slower than using a direct function call. So if you've got any bright ideas in that regard, I'm all ears.
Anyway, the code is new and we haven't used it much, but we thought we'd throw it out there early to get feedback from the community.
Cheers
-- Dan