[2.0] Scalate module for Play 2.0

887 views
Skip to first unread message

Ben McCann

unread,
Jan 11, 2012, 5:37:53 PM1/11/12
to play-fr...@googlegroups.com, peter....@hotmail.com, peter_...@hotmail.com
Hi,

I'm interested in having a Scalate plugin for Play 2.0.  Is anyone working on this yet?  Peter, should I clone your Play 1 module and try to make it compile for Play 2 or would you suggest starting from scratch?  Anything you'd want me to look at updating or changing while I'm making changes?  Hopefully I'll have something useable in a few weeks.

Thanks,
Ben

peter hausel

unread,
Jan 12, 2012, 5:34:51 PM1/12/12
to play-fr...@googlegroups.com, peter....@hotmail.com, peter_...@hotmail.com
Hi Ben,

It should be very straightforward to add scalate support to play2, one just needs to wrap the template engine initialization into a plugin. 

Please consult the following pages regarding plugins:


Hope this helps.

Cheers,
Peter

Will Sargent

unread,
Jan 12, 2012, 6:57:33 PM1/12/12
to play-fr...@googlegroups.com
Check out the work Matt Raible did for Scalate in Play 1.2 as well...


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/LBE6kka8lp4J.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

4e6

unread,
Jan 18, 2012, 8:37:13 AM1/18/12
to play-fr...@googlegroups.com, peter....@hotmail.com, peter_...@hotmail.com
Hi Ben,

I'm interested in Scalate plugin too. If you have some ideas how to implement it, I would be glad to help.

Also, it would be a nice feature to chain Scalate templates with Play20 ones.

For example, we have 
main.scaml.scala.html 
@(title: String)(content: Html)
!!! 5
%head
  %title @title
%body
  #main
    @content

Which is converted by Scalate to a Play template
main.scala.html
@(title: String)(content: Html)
<!DOCTYPE html>
<head>
  <title>@title</title>
</head>
<body>
  <div id='main'>
    @content
  </div>
</body>

I experimented a bit with http://haml-lang.com/try.html and it seems to work (at least with simple snippets).

Ben McCann

unread,
Jan 18, 2012, 4:56:58 PM1/18/12
to play-fr...@googlegroups.com, peter....@hotmail.com, peter_...@hotmail.com

I think you'd want to chain in the reverse order and turn a play template into a mustache template so that you could use it on the client side as well.

-Ben

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/7WxtiOCZIogJ.

Ben McCann

unread,
Jan 22, 2012, 7:37:39 PM1/22/12
to play-fr...@googlegroups.com
Thanks for the tips everyone.  I'm going to hold off on this for now.  I thought that the Scalate Mustache implementation was statically typed like the Play 2 templates, but it look like I might have been wrong about that.  I don't want to lose the static typing, so I'm going to put this on hold.

Thanks,
Ben

Matt Raible

unread,
Jun 5, 2012, 1:09:30 PM6/5/12
to play-fr...@googlegroups.com
I have Scalate 1.5.3 working with Play 2 based on the following blog post:


Now I'm wondering - what's the best way to display validation errors? In 1.x, I stuffed the errors into renderArgs and then rendered them with the following:

-@ val errors:Map[String,play.api.data.validation.Error]

-if (!errors.isEmpty() && !workout.map(_.id).isEmpty) {
  div(class="alert-message error fade in" data-alert="alert")
    a(class="close" href="#") &times;
    |  Please correct the errors below.
-}
Ben


To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.

Rodolfo Hansen

unread,
Apr 4, 2013, 7:45:36 PM4/4/13
to play-fr...@googlegroups.com
I've started work on getting Scalate to produce actual Play! templates


Right now it reads template files in the form of "/app/views/**.scalate.(jade|ssp|scaml|mustache|squery)"  and generates a .scala file for those templates.

I'm now trying to mold the generated .scala file into something Play! interprets.. Anyone willing to help?
Ben


To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages