I've been using script tags for javascript templates like this. (This example uses Handlebars.js but many other templating engines follow the same convention.)
<script id="template" type="text/x-handlebars-template">
<div>
<span>{{ title }}</span>
</div>
</script>
Visual Studio does not color code the HTML inside the <script>
tag. Is there a way to do that?
If the type does not need to be explicitly text/x-handlebars-template
, you can use text/html
instead. Visual Studio understands this is meant to be interpreted as HTML and will thus color code it appropriately.