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.

style and link tags not removed

See original GitHub issue

This is the original HTML:

<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" href="./styles.css">
</head>

And this is the result:

<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" href="./styles.css">
</head>

Same thing with <style> tags. The styles are inlined, but the tags are not removed from the result HTML.

const options = {
  removeStyleTags: true
};

let result = juice.inlineContent(originalFile, stylesFile, options);

Supposedly removeStyleTags is true by default but I added it to see if it made any difference.

Am I missing something?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
cossssmincommented, Oct 5, 2018

My understanding is that this actually works as intended.

From the README:

juice.inlineContent(html, css [, options])

This takes html and css and returns new html with the provided css inlined. It does not look at <style> or <link rel="stylesheet"> elements at all.

So yes, it inlines the styles, but doesn’t touch the tags they’re in. Maybe the last sentence in the description there is a bit vague?

0reactions
mateusgrbcommented, Aug 4, 2020

The last sentence could definitely be more explicit, I also misunderstood it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove ALL styling/formatting from hyperlinks
I'm creating a navigation menu with words with different colors ( href links). I would like ...
Read more >
How to Remove Underline from a Link in CSS
How to Remove Underline from a Link in CSS ... Firstly, it is important to know that the link tag (anchor tag) can...
Read more >
Styling links - Learn web development | MDN
Default styles · Use underlining for links, but not for other things. If you don't want to underline links, at least highlight them...
Read more >
How to Remove the Underline from Links in CSS
To remove the underline from links, you can use the CSS text-decoration property. Below we'll walk through how to define this property to ......
Read more >
Removing Link Icons - Web Guide
Home / User Guide / Styling Content / Removing Link Icons ... <a class="no-icon" href="https://www.med.unc.edu/webguide/wp-content/uploads/sites/419/2019/07 ...
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