I am looking for client side templating functionality - I am using the google.script calls to get the JSON data, and am building the UI via JQuery and JQuery UI - but had to loop through the data to build the UI. Client side templates would come in handy for my task, so was wondering if anyone had recommendations...I should look at the server side templating to see if I can return a fragment from the server and attach it on the client via JQuery DOM manipulation.
This is great Eric. Two things I would love to see in Appscript along these lines would be: 1) A JSLint checker so I don't have to debug simple syntax and logic errors in my code. When you're using UiApp, you just get an "Unexpected Error" message which is then a pain to troubleshoot.
2) Support for something like Coffeescript.
3) Make Google Appscript scripts shareable via Google Drive, so we can use our laptop client tools like Textmate/Coffeescript or Eclipse. Changes made on my laptop would appear directly in a program I'm debugging in the cloud. There are hacks where you can use eval(filename) in your code but this doesn't lend itself to online debugging.
UnderScore/Lodash is a really nice utility library. But `.each()` isn't an appropriate example in this case since `Array.prototype.forEach` is built-in with Google Apps Script which is based on JavaScript 1.8.
7 comments :
Cool. Can you suggest a good templating library? I tried using jquery templates but it did not work - I am not sure if it violates Caja's validation.
I am not too familiar with jQuery's templating engine, but HtmlService has its own that works really well with Apps Script take a look here
I am looking for client side templating functionality - I am using the google.script calls to get the JSON data, and am building the UI via JQuery and JQuery UI - but had to loop through the data to build the UI. Client side templates would come in handy for my task, so was wondering if anyone had recommendations...I should look at the server side templating to see if I can return a fragment from the server and attach it on the client via JQuery DOM manipulation.
This is great Eric. Two things I would love to see in Appscript along these lines would be:
1) A JSLint checker so I don't have to debug simple syntax and logic errors in my code. When you're using UiApp, you just get an "Unexpected Error" message which is then a pain to troubleshoot.
2) Support for something like Coffeescript.
3) Make Google Appscript scripts shareable via Google Drive, so we can use our laptop client tools like Textmate/Coffeescript or Eclipse. Changes made on my laptop would appear directly in a program I'm debugging in the cloud. There are hacks where you can use eval(filename) in your code but this doesn't lend itself to online debugging.
@Kris, Underscore actually contains it's some templating functionality: http://underscorejs.org/#template
@Autoblog, thanks for the feedback, we'll keep those ideas in mind.
UnderScore/Lodash is a really nice utility library. But `.each()` isn't an appropriate example in this case since `Array.prototype.forEach` is built-in with Google Apps Script which is based on JavaScript 1.8.
I think there's no need to define `.load()` since Underscore ships with `.noConflict()`.
Post a Comment