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.

🐛 Tags that do not belong to HTML should be ignored

See original GitHub issue

For services rendered as the template file, the template engine <%%>,{{}} marker package should be ignored, but the label disrupted

💻 Demo Code

<!DOCTYPE html>
<html>
<head>
	<title><%=title%></title>
	<link href="./style.css">
</head>
<body>
	<h1>Welcome : </h1>
<% if(data){ %>
	<p><%=data%></p>
<%}else{%>
	<p><%=request.session._flash||' Error '%></p>
<%}%>
</body>
<script src="./index.js"></script>
</html>

🤔 Expected Behavior

<!DOCTYPE html> <html> <head> <title><%=title%></title> <link href="/dist/1fb0a95e00274611850900f80a9d9d1e.css"> </head> <body> <h1>Welcome : </h1> <% if(data){ %> <p><%=data%></p> <%}else{%> <p><%=request.session._flash||' Error ' %></p> <%}%> </body> <script src="/dist/e2e07bfc7be96fd730ba9a0cd2160e84.js"></script> </html>

😯 Current Behavior

<!DOCTYPE html> <html> <head> <title><%=title%></%=title%></title> <link href="/dist/1fb0a95e00274611850900f80a9d9d1e.css"> </head> <body> <h1>Welcome : </h1> <% if(data){="" %=""> <p><%=data%></%=data%></p> <%}else{%> <p><%=request.session._flash||' Error="" '%=""></%=request.session._flash||'></p> <%}%> </%}%></%}else{%></%></body> <script src="/dist/e2e07bfc7be96fd730ba9a0cd2160e84.js"></script> </html>

💁 Possible Solution

parcel build test/demo.html -d ./test/dist/ --mangle-tag=<%%>,{{}}

🌍 My Environment

Software Version(s)
Parcel 1.4.1
Node v8.8.0
npm/Yarn Yarn
Operating System MacOS 10.12.6

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
DimaGashkocommented, Jul 6, 2020

Question: why are you processing template files with Parcel? Shouldn’t you be running them through the template engine first? Should we support an asset type for that template engine?

I’m just worried that these aren’t really valid HTML. How do we decide which tags to support? The tags might conflict between different template engines. We can’t possibly support them all by default, without explicit asset types for them I don’t think.

No, we should (if we want use parcel). The thing is there’re not only frontend things. For example now I’m developing small golang project with html templates (just to test one thing). So, since it small I don’t want to use something like gulp or webpack, but anyway I want to have compressed assets. Golang html templates is html with {{ . . . }} blocks. So, parcel can’t parse it. But since gotemplates is backend templating I can’t run it through the template engine first.

1reaction
DeMoorJaspercommented, Jan 17, 2018

Awesome work @maciej-ka , hope they merge it soonish 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are HTML tags silently ignored? - Meta Stack Exchange
What is the reasoning behind silently ignoring them? This would lead to users pasting in unformatted code and getting away with it.
Read more >
Chrome ignores label when it contains a strong element
It appears this is a bug with Chrome after discussions with OP and testing. Do not use <strong> , <em> etc. within labels,...
Read more >
8 The HTML syntax — HTML5 - W3C
The start and end tags of certain normal elements can be omitted, as described later. Those that cannot be omitted must not be...
Read more >
WebD2: Common HTML Tags - University of Washington
Tags in HTML are not case sensitive, but in XHTML all tags must be in lower case. Even when coding in HTML, ......
Read more >
95394 - The generic lang= attribute of HTML tags is ignored ...
The translate feature for chromium should follow the content-language tag before attempting to guess the language of the webpage.
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