Remove attributes

Maizzle can be configured to remove attributes from your HTML after it compiles it.

Usage

config.js
module.exports = {
  removeAttributes: [
    {name: 'data-src'}, // remove empty data-src="" attributes
    {name: 'foo', value: 'bar'}, // remove all foo="bar" attributes
  ]
}

Internally, Maizzle uses this to remove any CSS inlining leftovers, like style="".

API

app.js
const {removeAttributes} = require('@maizzle/framework')
const options = [
  {name: 'id'},
  {name: 'role', value: 'article'}
]

const html = await removeAttributes(`<div id="" style="" role="article"></div>`, options)

Copyright © 2022 Maizzle Edit this page on GitHub