Skip to content Skip to sidebar Skip to footer

Is It Possible To Compile Html Markup To Templatable Javascript On Coldfusion Server-side?

I have been looking at Javascript templating engines trying to find a way to have standard templates available on/offline. Currently I'm kind of stuck at dustjs/linkedIn which wou

Solution 1:

Take a look at CFGroovy. Although targeting groovy, it's really a way for CF to use the generic scripting features of Java (JSR-223) You ought to be able to start Rhino through this and run your code. In fact, Ben Nadel has an article on doing this.

Althernatively, you could put node on your server and use cfexecute to run node to compile your templates.

If you make it work, I'd consider not compiling on a schedule. Perhaps try one fo the following:

  • Compile as part of your build, if you have a defined build process.
  • Compile on demand, so your script URLs might be script.cfm?script=whatever.js and have CF check dates and either compile the template or
  • Use the DirectoryWatcher event gateway to monitor your script folder and compile-on-change.

I like the third option best, as it'll only compile on change, which is probably what you want.

Post a Comment for "Is It Possible To Compile Html Markup To Templatable Javascript On Coldfusion Server-side?"