Skip to content

Add an option to remove specific CSS declarations #52

@imtheu

Description

@imtheu

Is your feature request related to a problem? Please describe.
Not all properties are essential in critical CSS. For example, properties such as cursor, color, or border-radius may not need to be included in the final critical CSS. Therefore, it would be incredibly beneficial to have an option to exclude certain declarations from the final critical CSS, which would reduce the overall size.

Describe the solution you'd like
A potential solution could be to introduce a removeDeclarations option

Describe alternatives you've considered
We could use the postcss-discard plugin for this purpose. It accepts a String, RegExp, or a Function to specify which declarations to exclude.

Original CSS:

.pseudo-selector::before {
    color: silver;
    content: 'pseudo ::before';
}

Crittr:

Crittr({
    removeDeclarations: [/color/]
})

Final CSS:

.pseudo-selector::before {
-    color: silver;
    content: 'pseudo ::before';
}

I am willing to contribute and open a PR if you are interested.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions