question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support underscore templates

See original GitHub issue

Description

Taken from https://github.com/Microsoft/vscode/issues/20197.

Motivation

Underscore templates within HTML are a common feature in solutions like html-webpack-plugin.

Input

The code looked like this before beautification:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <% console.log('hello') %>
  <title>Login</title>
</head>
<body>
  <%
    // copy configs
    require('copy-loader!./foo.js');
  %>
  <script src="foo.js"></script>
</body>
</html>

Expected Output

The code should have looked like this after beautification: no change.

Actual Output

The code actually looked like this after beautification:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <% console.log('hello') %>
    <title>Login</title>
</head>
<body>
  <%
    // copy configs
    require('copy-loader!./foo.js');
  %>
    <script src="foo.js"></script>
</body>
</html>

It looks like every tag after <% %> is indented by two spaces.

Steps to Reproduce

  • VS Code Version: Version 1.10.0-insider (1.10.0-insider)
  • VS Code Setting: "html.format.enable" is true.

Environment

  • OS Version: Mac OS X 10.12.3

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
divyamrastogicommented, Feb 5, 2018

Is this possible? Having beautify do this would save me and a lot of other developers working on BackboneJS from a lot of pain.

0reactions
MacKLesscommented, Aug 23, 2018

This appears to have been resolved as of v1.8.0-rc13. @donaldpipowitch and @CNSKnight please double check and let me know if you disagree.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Underscore.js
Underscore provides over 100 functions that support both your favorite workaday functional helpers: map, filter, invoke — as well as more specialized ...
Read more >
A closer look at Underscore templates - 2ality
Underscore's templates are very simple. Their disadvantage is that they always look a bit ugly. Their advantage is that they are dead-simple to ......
Read more >
Support underscore templates in "html.format.enable" #20197
Underscore templates within HTML are a common feature in solutions like html-webpack-plugin.
Read more >
Support highlighting underscore.js (and similar) templates
Can we ammend this bug title and description to cover all javascript templating languages - ie. Mustache, jQuery template, etc.? I'm experiencing similar...
Read more >
Working with Underscore JavaScript Templates
js, which is an easy-to-learn JavaScript library. Web based applications are very popular due to cross-platform support. They also don't need ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found