Is :coffeescript support built in?

63 views
Skip to first unread message

bloo

unread,
Jul 12, 2013, 5:34:12 PM7/12/13
to sca...@googlegroups.com
I'm trying to use the :coffeescript filter in my jade templates, according to the documentation and every example and post in this group I can find, but it's just printing it to the resulting html as "text/coffeescript" without compilation. I had to add org.fusesource.scalamd %% scalamd to my project to get :markdown working, but I can't find any mention of a similar dependency for the coffeescript filter.  I'm running unfiltered-jetty + scalate-core 1.6.1. I assumed server side coffeescript compilation was built in to scalate (making container/web server I'm using is irrelevant..?), but I am obviously doing something wrong.

Am I missing something obvious?

Thanks.

Rafał Krzewski

unread,
Jul 14, 2013, 11:20:45 AM7/14/13
to sca...@googlegroups.com
At this point CoffeeScript filter is part of scalate-core. You need to have Rhino on runtime classpath, but otherwise it shouldn't require any additional configuration.
You could try to follow the initialization sequence of Scalate under debugger, it's not very complicated :)

Cheers,
Rafał

bloo

unread,
Jul 14, 2013, 11:47:40 AM7/14/13
to sca...@googlegroups.com
Last night I did just that! It was in the debugger that I saw the bootstrap sequence looking for Rhino on the classpath to enable server side compilation. So I added it, and it was good. I wasn't sure if it was a scalate-rhino dependency that I couldn't find (like scalate-jruby or md for markdown) but mozilla's rhino jar was all I needed.

Is there a way to contribute to the documentation? I'm also at a loss on how to enable the :less filter (it does not seem to be included in core, unless :sass).

Thanks Rafał.

Rafał Krzewski

unread,
Jul 14, 2013, 11:59:45 AM7/14/13
to sca...@googlegroups.com
Yes, Mozilla Rhino is all you need. It's an optional dependency of scalate-core, that's why it's not pulled into the classpath as a transitive dependecy by default.
IMO, it woul be better to move CoffeeScript filter into it's own module, which would then have a hard (non-optional) dependency on Rhino (less surprise factor for users) and it would also make scalate-core jar a tiny bit smaller. 

Regarding less filter: it's hosted in a separate module scalate-less, but it's broken at the moment. I'll have some fixes and enhancements for it sitting on a private branch. If you are interested in testing it I can clean up & publish these changes later this week.

Sure, there is a way to contribute to the documentation. You need to fork Scalate repository on github, clone it to your machine and look into scalate-website module. It's a bunch of markdown files that you can edit, commit, push your changes to github and then submit pull requests.

Cheers,
Rafał

bloo

unread,
Jul 14, 2013, 12:18:02 PM7/14/13
to sca...@googlegroups.com
The separated coffeescript module sounds like a good idea indeed. I would definitely test any scalate-less fixes whenever you publish them.

Rafał Krzewski

unread,
Jul 16, 2013, 2:07:33 PM7/16/13
to sca...@googlegroups.com
Hi,

I've posted my improvements to scalate-less module: https://github.com/scalate/scalate/pull/54
If you could bulid them locally off my branch https://github.com/rkrzewski/scalate/tree/less_includes and give them a spin it would be great!

Cheers,
Rafał
Reply all
Reply to author
Forward
0 new messages