Haml 2.0 Inline Javascript
I went looking for a way to embed a short little script in my Haml template, but didn’t find much in my googling. Turns out that before Haml 2.0, to do this, it requires a custom filter. Well, now Haml 2.0 ships with a built-in javascript filter.
.before content above script :javascript alert("Hello World"); alert("More scripting!"); .after content after script
The script gets wrapped in <script> tags, and works as expected.
April 9th, 2010 at 2:01 am
Thanks. It works fine.