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.

is it possible to remove style attributes ?

See original GitHub issue

i was hoping to do something like:

minify(HTMLSTRING,{
    attrBlackList: ['style']
});

is it possible to achieve the same functionality ?

Issue Analytics

  • State:open
  • Created 9 years ago
  • Reactions:3
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
duncanbeeverscommented, May 31, 2015

This seems like something you’d use a general post-processor for, rather than adding this feature to html-minifier.

After you minify with html-minifier, you can reprocess the output, either with another full-fledged html parser, or with something as simple as sed.

1reaction
HitkoDevcommented, Jul 4, 2016

Looking at src/htmlparser.js it seems that currently HTML is parsed using a combination of linear parser and dynamic regular expressions for matching segments of code.

Another thing @duncanbeevers, I believe removing data-, aria-, ng- and similar attributes belongs under the basic function of HTML minification.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove Style on Element - javascript - Stack Overflow
//Get the value of style attribute based on element's Id var originalStyle = document.getElementById('sample_id').getAttribute('style'); var ...
Read more >
Remove CSS Style Property from an Element using JavaScript
Use the style.removeProperty() method to remove CSS style properties from an element, e.g. box.style.removeProperty('background-color') . The ...
Read more >
How to remove style added with .css() function using ...
How to remove style added with .css() function using JavaScript? ; css():It sets or returns one or more style properties for selected elements....
Read more >
Remove inline CSS properties from an element with ...
If you want to remove the style attribute of an element completely, you can use JavaScript's removeAttribute() method. JS; CSS; HTML. JS. 1....
Read more >
How to remove all style attributes using jQuery? - Tutorialspoint
To remove an attribute from each tag using jQuery, use the removeAttr() method and use the Universal Selector. Let us see how to...
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