html-attributes-remover

1.0.4 • Public • Published

Html Attributes Remover

About this Package

Provide a list of attributes you need to remove from provided html or selective tags of html

Install:

npm install html-attributes-remover

Remove html attributes like style, class from div tags

const AttributeRemover = require('html-attributes-remover').default
const attributeRemover   = new AttributeRemover({
  "htmlTags": ["div"],
  "attributes": ["style", "class"]
})

let html    = "<div class='row' style='color:red;'><p><span style='font-size:100;'>Hello there!</span></p></div>"
let newHtml = attributeRemover.remove(html)
console.log(newHtml) // "<div><p><span style='font-size:100;'>Hello there!</span></p></div>"

If you want to remove attributes from all html tags then do not mention any htmlTags while initializing the AttributeRemover class

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    14
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    14
  • 1.0.3
    0
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    1

Package Sidebar

Install

npm i html-attributes-remover

Weekly Downloads

16

Version

1.0.4

License

ISC

Unpacked Size

2.61 kB

Total Files

3

Last publish

Collaborators

  • dhakershiv