Set Javascript Type in Ruby Slim File
You could just use a regular script tag and escape the javascript:
script type="application/ld+json"
| alert('hi’)
Or you could create a shortcut to accomplish this:
From https://github.com/slim-template/slim:
You can also set additional fixed value attributes to a shortcut.
Slim::Engine.set_options shortcut: {'^' => {tag: 'script', attr: 'data-binding',
additional_attrs: { type: "text/javascript" }}}
Then
^products
== @products.to_json
which renders to
<script data-binding="products" type="text/javascript">
[{"name": "product1", "price": "$100"},
{"name": "prodcut2", "price": "$200"}]
</script>