I haven’t been able to find anything on how this tag works. Why should I use the {% javascript %} instead of HTML script tag? Is there any difference? I’ve checked the Shopify cheatsheet which describes every other tag, as well as sifted through several pages of google and haven’t found anything substantial.
2
Answers
It is simply a convenience for you. It offers you no special capabilities. It nice because to the less than stellar technical person, someone who might get a little Liquid but not much else, it is pretty clear that the stuff inside the tag is likely Javascript. They recommend you only use these tags if your section is meant for a widely distributed theme, and or many shops. In other words, if you like script tags, go ahead and use them, no harm done.
If you are adding the
{% javascript %}
tag in a themesection
context then:Reference