{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://raw.githubusercontent.com/j9t/html-minifier-next/main/html-minifier-next.schema.json", "title": "HTML Minifier Next configuration", "description": "Configuration file for HTML Minifier Next (HMN), used via `--config-file`", "type": "object", "properties": { "$schema": { "description": "JSON Schema reference for this configuration file (enables editor validation and autocomplete)", "type": "string" }, "preset": { "description": "Preset configuration to start from—config file options override preset options", "enum": [ "conservative", "comprehensive" ] }, "fileExt": { "description": "File extension(s) to process, as comma-separated string or array (default: `html,htm,shtml,shtm`; use `*` for all files)", "type": [ "string", "array" ], "items": { "type": "string" } }, "ignoreDir": { "description": "Directories—relative to the input directory—to exclude from processing, as comma-separated string or array", "type": [ "string", "array" ], "items": { "type": "string" } }, "cacheCSS": { "description": "Set CSS minification cache size (number of entries, default: 500)", "type": "integer", "minimum": 0 }, "cacheJS": { "description": "Set JavaScript minification cache size (number of entries, default: 500)", "type": "integer", "minimum": 0 }, "cacheSVG": { "description": "Set SVG minification cache size (number of entries, default: 500)", "type": "integer", "minimum": 0 }, "caseSensitive": { "description": "Treat attributes in case-sensitive manner (useful for custom HTML elements)", "type": "boolean" }, "collapseAttributeWhitespace": { "description": "Trim and collapse whitespace characters within attribute values", "type": "boolean" }, "collapseBooleanAttributes": { "description": "Omit attribute values from boolean attributes", "type": "boolean" }, "collapseInlineTagWhitespace": { "description": "Collapse whitespace more aggressively between inline elements—use with `--collapse-whitespace`", "type": "boolean" }, "collapseWhitespace": { "description": "Collapse whitespace that contributes to text nodes in a document tree", "type": "boolean" }, "conservativeCollapse": { "description": "Always collapse to one space (never remove it entirely)—use with `--collapse-whitespace`", "type": "boolean" }, "continueOnMinifyError": { "description": "Continue on minification errors", "type": "boolean" }, "continueOnParseError": { "description": "Handle parse errors instead of aborting", "type": "boolean" }, "customAttrAssign": { "description": "Array of regexes that allow to support custom attribute assign expressions (e.g., `
`)", "type": [ "string", "array" ], "items": { "type": "string" } }, "customAttrCollapse": { "description": "Regex that specifies custom attribute to strip newlines from (e.g., `/ng-class/`)", "type": "string" }, "customAttrSurround": { "description": "Array of regexes that allow to support custom attribute surround expressions (e.g., ``)", "type": [ "string", "array" ], "items": { "type": "string" } }, "customEventAttributes": { "description": "Array of regexes that allow to support custom event attributes for minifyJS (e.g., `ng-click`)", "type": [ "string", "array" ], "items": { "type": "string" } }, "customFragmentQuantifierLimit": { "description": "Set maximum quantifier limit for custom fragments to prevent ReDoS attacks (default: 200)", "type": "integer", "minimum": 0 }, "decodeEntities": { "description": "Use direct Unicode characters whenever possible", "type": "boolean" }, "ignoreCustomComments": { "description": "Array of regexes that allow to ignore matching comments", "type": [ "string", "array" ], "items": { "type": "string" } }, "ignoreCustomFragments": { "description": "Array of regexes that allow to ignore certain fragments, when matched (e.g., ``, `{{ … }}`)", "type": [ "string", "array" ], "items": { "type": "string" } }, "includeAutoGeneratedTags": { "description": "Insert elements generated by HTML parser", "type": "boolean" }, "inlineCustomElements": { "description": "Array of names of custom elements which are inline, for whitespace handling", "type": [ "string", "array" ], "items": { "type": "string" } }, "keepClosingSlash": { "description": "Keep the trailing slash on void elements", "type": "boolean" }, "maxInputLength": { "description": "Maximum input length to prevent ReDoS attacks", "type": "integer", "minimum": 0 }, "maxLineLength": { "description": "Specify a maximum line length; compressed output will be split by newlines at valid HTML split-points", "type": "integer", "minimum": 0 }, "mergeScripts": { "description": "Merge consecutive inline `script` elements into one", "type": "boolean" }, "minifyCSS": { "description": "Minify CSS in `style` elements and attributes (uses Lightning CSS)", "type": [ "boolean", "string", "object" ] }, "minifyJS": { "description": "Minify JavaScript in `script` elements and event attributes (uses Terser or SWC; pass `{\"engine\": \"swc\"}` for SWC)", "type": [ "boolean", "string", "object" ] }, "minifySVG": { "description": "Minify SVG elements (uses SVGO)", "type": [ "boolean", "string", "object" ] }, "minifyURLs": { "description": "Minify URLs in various attributes", "type": [ "boolean", "string", "object" ] }, "noNewlinesBeforeTagClose": { "description": "Never add a newline before a tag that closes an element", "type": "boolean" }, "partialMarkup": { "description": "Treat input as a partial HTML fragment, preserving stray end tags and unclosed tags", "type": "boolean" }, "preserveLineBreaks": { "description": "Always collapse to one line break (never remove it entirely) when whitespace between tags includes a line break—use with `--collapse-whitespace`", "type": "boolean" }, "preventAttributesEscaping": { "description": "Prevents the escaping of the values of attributes", "type": "boolean" }, "processScripts": { "description": "Array of strings corresponding to types of `script` elements to process through minifier (e.g., `text/ng-template`, `text/x-handlebars-template`, etc.)", "type": [ "string", "array" ], "items": { "type": "string" } }, "quoteCharacter": { "description": "Type of quote to use for attribute values (`'` or `\"`)", "type": "string" }, "removeAttributeQuotes": { "description": "Remove quotes around attributes when possible", "type": "boolean" }, "removeComments": { "description": "Strip HTML comments", "type": "boolean" }, "removeDefaultTypeAttributes": { "description": "Remove default `type` attributes from `style`/`link` (e.g., `type=\"text/css\"`) and `script` (e.g., `type=\"text/javascript\"`) elements; other `type` attribute values are left intact", "type": "boolean" }, "removeEmptyAttributes": { "description": "Remove all attributes with whitespace-only values", "type": "boolean" }, "removeEmptyElements": { "description": "Remove all elements with empty contents", "type": "boolean" }, "removeEmptyElementsExcept": { "description": "Array of elements to preserve when `--remove-empty-elements` is enabled (e.g., `td`, ``)", "type": [ "string", "array" ], "items": { "type": "string" } }, "removeOptionalTags": { "description": "Remove optional tags", "type": "boolean" }, "removeRedundantAttributes": { "description": "Remove attributes when value matches default", "type": "boolean" }, "removeTagWhitespace": { "description": "Remove space between attributes whenever possible; note that this will result in invalid HTML", "type": "boolean" }, "sortAttributes": { "description": "Sort attributes by frequency", "type": "boolean" }, "sortClassNames": { "description": "Sort style classes by frequency", "type": "boolean" }, "trimCustomFragments": { "description": "Trim whitespace around custom fragments (`--ignore-custom-fragments`)", "type": "boolean" }, "useShortDoctype": { "description": "Replaces the doctype with the short HTML doctype", "type": "boolean" } }, "additionalProperties": false }