Jade interpolation within javascript
pug, scalate, scalatra
Solution
I found that `:&javascript` or `:!javascript` will work. It is explained here.
Problem
(Note, this is the Scalate Jade, if that makes a difference) I have the following route: ``` get("/fruit") { contentType = "text/html" jade("fruity", "fruit" -> "apple") } ``` And this `fruity.jade` template: ``` -@ val fruit: String p Alerting #{fruit} :javascript alert("#{fruit}"); ``` It renders like so: ``` <body><p>Alerting apple</p> <script type="text/javascript"> //<![CDATA[ alert("#{fruit}"); //]]> </script> </body> ``` The `fruit` value is not interpolated for the javascript portion. How can I get it to resolve in javascript?