PHP-Twig.tmbundle icon indicating copy to clipboard operation
PHP-Twig.tmbundle copied to clipboard

Script tag breaks the highlighting

Open charmpitz opened this issue 8 years ago • 2 comments

If u have a for loop inside the script tag it will break the highlighting. Try it in sublime.

Example:

<script type="text/template">
 {#Twig code here #}
</script>

charmpitz avatar Mar 15 '16 13:03 charmpitz

It doesn't need to be a loop. Any twig blocks inside the <script> tags will be scoped as a JavaScript object literal. {{ someVar }} seems to do more damage than {% if someVar %} as far as the highlighting goes.

JonathanHolvey avatar Jul 25 '18 07:07 JonathanHolvey

The highlighting will break whenever there is anything than Javascript code inside the script tags.

I always been quite annoyed by that, since I often use <script> to define HTML templates. So I made a pull request to fix that (#73 ). 😃

Give a try! (and eventually close the issue)

Pictor13 avatar May 09 '19 17:05 Pictor13