Skip to content

Can't disable removal of attribute quotes from html #10211

@bitbof

Description

@bitbof

🐛 bug report

Parcel ignores "removeAttributeQuotes": false in `.htmlnanorc'.

🎛 Configuration (.babelrc, package.json, cli command)

package.json

{
  "type": "module",
  "dependencies": {
    "@emotion/css": "^11.13.5",
    "@types/jest": "^30.0.0",
    "@typescript-eslint/eslint-plugin": "^8.41.0",
    "@typescript-eslint/parser": "^8.41.0",
    "ag-psd": "^28.2.2",
    "buffer": "^6.0.3",
    "chalk": "5.6.0",
    "count-lines-of-code": "^1.0.6",
    "csv-reader": "^1.0.12",
    "csv-writer": "^1.6.0",
    "dotenv": "^17.2.1",
    "eslint": "^9.34.0",
    "eslint-plugin-no-null": "^1.0.2",
    "eslint-plugin-unused-imports": "^4.2.0",
    "fs-extra": "^11.3.1",
    "glob": "^11.0.3",
    "globals": "^16.3.0",
    "jest": "^30.1.1",
    "js-beautify": "^1.15.4",
    "jsdom": "^26.1.0",
    "json5": "^2.2.3",
    "mdn-polyfills": "^5.20.0",
    "parcel": "^2.15.4",
    "polygon-clipping": "^0.15.7",
    "stats.js": "^0.17.0",
    "svgo": "^4.0.0",
    "transformation-matrix": "^3.1.0",
    "ts-jest": "^29.4.1",
    "typescript": "^5.9.2",
    "typescript-eslint": "^8.41.0"
  },
  "devDependencies": {
    "@parcel/transformer-glsl": "^2.15.4",
    "@parcel/transformer-sass": "^2.15.4",
    "@types/stats.js": "^0.17.4",
    "prettier": "3.6.2",
    "process": "^0.11.10"
  }
}

.htmlnanorc

{
  "removeAttributeQuotes": false,
  "removeComments": false
}

command: parcel build src/index.html --dist-dir _dist

🤔 Expected Behavior

HTML comments and attribute quotes are kept in the resulting HTML.

😯 Current Behavior

Comments are kept, but attribute quotes are still removed.

💁 Possible Solution

Maybe parcel doesn't support all htmlnano config settings? Adding support for "removeAttributeQuotes" would make sense.

🔦 Context

Before upgrading parcel, my resulting html had quotes. Upgrading parcel led to things breaking for me due to no quotation marks. It made the migration bumpier.

According to parcel docs, parcel's internal html minimizer is compatible with htmlnano configs: "Parcel uses its builtin HTML minifier, which is compatible htmlnano." https://parceljs.org/languages/html/#minification

"removeAttributeQuotes" is a htmlnano setting: https://htmlnano.netlify.app/modules#removeattributequotes

💻 Code Sample

🌍 Your Environment

see package json

Software Version(s)
Parcel 2.15.4
Node 22.18.0
npm/Yarn npm 9.8.0
Operating System win 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions