tags on .html files. Example:
Some rendered content Here. tags on .html files. Example:
Some rendered content Here. tags on .html files. Example:
Some rendered content Here.

VS Code : Syntax Highlight for Mustache code inside <script> tags in HTML file

85 Views Asked by At

On our company we use Mustache templates inside embedded <script type="mustache"> tags on .html files. Example:

<div>
  Some rendered content Here.
  <div id="target"></div>
</div>

<script type="mustache" id="people_template">
  Here some people names.
  {{#people}}
    Name: {{name}}
  {{/people}}
</script>

<script type="text/javascript">
  // some code to render the template to the DOM
</script>

VS Code correctly highlights JS code in embedded <script> or <script type="text/javascript"> tags.

The type attribute is important:

  • It does not highlight it if <script type="blah">
  • It does highlight it as HTML if <script type="text/html">

How can I instruct VS Code to Highlight embedded <script type="mustache"> as Mustache, using extensions like vscode-mustache-syntax-highlighting?

0

There are 0 best solutions below