10

I'm tring to embed scalate in my website with sbt+jrebel, but found there are some problems I can't resolve.

So I want to know if there any other template engines based on scala?

Jim Ferrans
  • 30,582
  • 12
  • 56
  • 83
Freewind
  • 193,756
  • 157
  • 432
  • 708

8 Answers8

4

How about popping on the Scalate group and describing the actual problems you're having? Am sure its fairly straight forward to work around? If the issue you're having is to do with sbt + jrebel and class reloading of scala code that you want to use inside your template engine; switching template engine's isn't sounding like an option (unless you want to stop using Scala in your templates). Plus Scalate is really the best and most popular template engine that uses Scala expressions inside it.

James Strachan
  • 9,168
  • 34
  • 31
  • thank you very much. I have post some threads in scalate group before, but I'm not very good at scala(and the classloader of Java), that I can't find the reason. – Freewind Mar 14 '11 at 10:32
  • you are right. Scalate is still the best one for me. PS: I have tried your jrebel plugin, but still not work with sbt. Finally, I decided to run without jrebel, just let jetty reload the webapp. – Freewind Mar 15 '11 at 15:35
  • Scalate startup time could be improved, it takes several seconds just to initialize template engine. Also, with Scalate I get scala-compiler jar as a dependency. – Tvaroh Oct 09 '13 at 12:38
  • 1
    It's seems like gitter group is abandoned, and google groups also. It's pity that scala doesn't have any simple template engine with good community... Twirl sucks because it's not supported in idea community edition – Alexander Kondaurov Apr 29 '19 at 20:10
4

Play framework for scala has a brand new scala template engine

not sure if it can be used outside of play

http://scala.playframework.org/documentation/scala-0.9.1/templates

opensas
  • 60,462
  • 79
  • 252
  • 386
  • 3
    [Twirl](https://github.com/spray/twirl) seems to allow this. (Not tried it though) – arashi01 Feb 23 '13 at 00:07
  • Since Play 2.3, [Twirl](https://github.com/playframework/twirl) has been split out of the Play project and can be used as a template engine in its own right. – DCKing Jul 09 '14 at 10:24
3

Pure Scala DSLs:

"Regular" templating engines:

2

Thanks to String Interpolation from Scala 2.10, now we can use native syntax to generated a complex text content.

Just use Fastring. It has both good performance and simple usage.

Yang Bo
  • 3,586
  • 3
  • 22
  • 35
0

If you're running on the JVM, Scala's interoperability with Java would let you use Velocity or Freemarker.

Jim Ferrans
  • 30,582
  • 12
  • 56
  • 83
0

I might want to look at Stitchr which was largely inspired by StringTemplate

Rustem Suniev
  • 1,149
  • 9
  • 8
0

Scalasti is a Scala wrapper around StringTemplate.

Wilfred Springer
  • 10,869
  • 4
  • 55
  • 69
-1

As already mentioned above, I would recommend using Twirl (the template system from Play). It's now very easy to use standalone. You'll have compile time checking of your templates and many more cool and simple stuff:

https://github.com/spray/twirl

Chris W.
  • 2,266
  • 20
  • 40