Skip to content

Remove unused css during build #25607

@zehavibarak

Description

@zehavibarak

Command

build

Description

It can be useful to be able to remove unused css styles during build, to reduce the overall size of the build. Our project mini css , for example, is as large as 11Mb due to 3rd party libraries of charts, etc.

Describe the solution you'd like

Such a feature may be setup in angular.json, with a collection of ignore list:

{
   "dropUnsedStyles": true,
   "keepStyles": ["my-css-decoration"]
}

Describe alternatives you've considered

webpack has such a plugin, needs some adjustments to work with ng build.

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