Support underscore templates
See original GitHub issueDescription
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"
istrue
.
Environment
- OS Version: Mac OS X 10.12.3
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is this possible? Having beautify do this would save me and a lot of other developers working on BackboneJS from a lot of pain.
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.