Learned another bit of #SlimLang syntax I’d somehow missed – you can omit `do` in blocks, so this is fine:
- [ 1, 2, 3 ].each
p Hello #{_1}!
Not sure I like it…
I only learned yesterday that in #SlimLang, you can interpolate unescaped values with #{{ … }}.
Replacing some
javascript:
let foo = #{raw foo.to_json}
with
javascript:
let foo = #{{foo.to_json}}
Other than being shorter, it also works in #Sinatra which doesn’t have Rails’s HTML safety model.
(Might also explore moving some of these to data attributes or something.)