soynode -- request for feedback

51 views
Skip to first unread message

Dan Pupius

unread,
May 24, 2012, 6:36:58 PM5/24/12
to closure-lib...@googlegroups.com, closure-temp...@googlegroups.com
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

Nathan Naze

unread,
May 24, 2012, 6:55:10 PM5/24/12
to closure-lib...@googlegroups.com, closure-temp...@googlegroups.com
To track, I've moved the wiki page and added soynode to the list:

http://code.google.com/p/closure-library/wiki/RelatedProjects

Nathan

Dan Pupius

unread,
May 24, 2012, 8:37:25 PM5/24/12
to closure-temp...@googlegroups.com, closure-lib...@googlegroups.com
Thanks Nathan.

Dan Pupius

unread,
Aug 9, 2012, 12:48:54 PM8/9/12
to closure-temp...@googlegroups.com, closure-lib...@googlegroups.com
Hey, we integrated it into an express based system pretty easily, what problems did you have?

On Wed, Aug 8, 2012 at 7:50 PM, Jamie Stackhouse <cont...@gmail.com> wrote:
Hi Dan!

I found this module when I was looking into getting Soy Templates integrated with Node + Express. I had a hell of a time getting it integrated with the view engine in Express, so I took inspiration from your project and built a glove that fits nicely into express, however it is lacking the compilation step so it requires pre-compiled templates. I'm working on it though. Thanks, I wouldn't have known where to start.

If anyone else is trying to integrate into Express, here's a link to where I'm hosting,
https://github.com/jamie-stackhouse/soy 

I'm still a beginner to Node, so any issues you see / can help fix would be appreciated!

Jamie Stackhouse

unread,
Aug 8, 2012, 10:50:43 PM8/8/12
to closure-temp...@googlegroups.com, closure-lib...@googlegroups.com
Hi Dan!

I found this module when I was looking into getting Soy Templates integrated with Node + Express. I had a hell of a time getting it integrated with the view engine in Express, so I took inspiration from your project and built a glove that fits nicely into express, however it is lacking the compilation step so it requires pre-compiled templates. I'm working on it though. Thanks, I wouldn't have known where to start.

If anyone else is trying to integrate into Express, here's a link to where I'm hosting,
https://github.com/jamie-stackhouse/soy 

I'm still a beginner to Node, so any issues you see / can help fix would be appreciated!

On Thursday, 24 May 2012 19:36:58 UTC-3, Dan wrote:
Reply all
Reply to author
Forward
0 new messages