Skip to content

Change removal of unused CSS to just a warning #7751

@EskelCz

Description

@EskelCz

Describe the problem

My case: Imagine you import a component from a 3rd party module (custom Select for example) and want to style it contextually (for example setting width for just one component/page) using classes within that component and the author didn't expose the particular value as a css variable. You are out of luck.

You either have to fork the module to add the variable, or add a global id just so you can target it in a global stylesheet, which is not the place you will look for the value at a later time. Either option is not developer friendly.

There are multiple github issues and stackoverflow questions about how to get around this, so there is clearly demand. I feel like this is a case where Svelte might be too opinionated.

Am I missing something? What is the case for the purge being mandatory?

Describe the proposed solution

The purging of "unused CSS" should be just a warning, or svelte should provide a configuration option to change the default behaviour.

Alternatives considered

Considered polluting the global css (by using :global). Not an option for anyone who uses Svelte to achieve a well organised code.

Importance

i cannot use svelte without it

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