Skip to content

Change the optimization minify option to allow removing whitespaces but keep comments #26427

Closed
@CarlosTorrecillas

Description

@CarlosTorrecillas

Which @angular/* package(s) are relevant/related to the feature request?

No response

Description

At the moment, as far as I know and as per the docs, the minify option accepts only a boolean and does everything to reduce the size of the final CSS (removing excess of whitespaces and comments). This can become a problem if you run a postbuild task that removes the unused CSS using PurgeCSS for example. Since purge looks for comments such as /* purgecss start ignore */ it won't find them and therefore it will remove the css block

Proposed solution

Extend the minify option to accept either a boolean (right now) or two properties: whitespaces and comments so we are able to tweak accordingly

Alternatives considered

Run another postbuild task that will remove the whitespaces "manually" after the CSS optimization

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