kangax / kangax/html-minifier

`clean-css`: Incorrect output if a whitespace is placed after a custom fragment

Open
#1,121 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
577
PR merge metrics
No merged PRs in 30d

Description

Given below config:
```js
{ minifyCSS: true, ignoreCustomFragments: [ /{{[#^\/]?.*?}}/ ] }
```
results in:
```html


  • ```
    (demo: https://replit.com/@lemnis/htmlmin#index.js)

    ---

    The issue doesn't exist if the space between `}}` and `display` is removed or if the semicolon is placed after the second custom fragment.

    Contributor guide

    No contributing guide indexed for this repository

    Research direction

    Reproduce the issue with the JavaScript configuration and example from the linked Replit demo, focusing on minifyCSS handling of ignoreCustomFragments. Trace the custom-fragment and whitespace processing, then verify that the output preserves both fragments and removes only the intended whitespace as shown in the expected HTML.

    Written by the indexing model from the issue text.

    Assessment

    Tech stack
    css, javascript
    Domain
    tooling
    Issue type
    Bug
    Difficulty
    3/5
    Estimated time
    1-2 days
    Activity status
    Stale
    Clarity
    Mostly clear
    Newbie friendliness
    45/100

    Get new issues in your inbox

    A short digest of beginner-friendly GitHub issues.