Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs or envjs - dynamic jquery tmpl

Tags:

My current task is to generate and provide centralized templates for a particular DOM - for this example let's just say it's a form.

Basically I'd like to take each form element (from the labels, to the inputs, to the div wrappers) and save them as individual templates.

From there we will have a UI where our producers can piece together these forms. Once they decide how they want their form to be layed out (DOM order and structure is actually critical for this project. It can not be a CSS-only solution), a script on our platform side will save a JSON object which will determine the structure of the DOM based on template names which I can reference on page load later on.

I'm thinking that an ideal solution here would be to send that JSON object to a node server or use envjs somehow to 'build' this dom and then assign it to a PHP variable to be included in the CodeIgniter view so it can be indexed by Google.

I know JQuery works natively with envjs and I know there's a JQuery plugin for node, but alas, this is my first server-side JS project and it happens to be pretty major. I was able to get envjs working on my local machine through the command line but it takes a good 10-30 seconds to complete a simple task. If envjs is the way to go, how can I keep it running in the background and have scripts reference it? PHP curl to an envjs servlet on Tomcat maybe?

One caveat is my local dev is WAMP (IT won't let us have local unix machines) but our test and production environments are both LAMP. I do have a personal LAMP server I can test on if that's the absolute-only way to go here, but coding company stuff on my personal server can get me in some heat.

Unfortunately I don't have time to research all the possibilities and try/fail as I normally would with new technologies on my own time. Ideas, guidance, code examples - anything that can help me decide how to approach this would be greatly appreciated.