Skip to content

file level pure mode opt-out #84

@jantimon

Description

@jantimon

I got some feedback about styling third-party React components for cssmodules-pure-ignore

in those cases where you need /* cssmodules-pure-ignore */ very often you need it several times e.g. when styling over an external library:

/* cssmodules-pure-ignore */
:global(.select__control) { border: 1px solid #e2e8f0 }

/* cssmodules-pure-ignore */
:global(.select__menu) { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) }

/* cssmodules-pure-ignore */
:global(.select__option--is-selected) { background: #4299e1 }

/* and so on... */

and for postcss-nested it's even worse as every & selector (e.g. &:hover) must have its own ignore comment..

what do you think about adding a cssmodules-pure-no-check flag that can be placed at the file root to disable pure mode for the entire file:

/* cssmodules-pure-no-check */

:global(.select__control) { border: 1px solid #e2e8f0 }
:global(.select__menu) { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) }
:global(.select__option--is-selected) { background: #4299e1 }

I'll add a small pr so maybe looking at it helps to understand the idea

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