Skip to content

Use a CSS layer for styles #518

@Gawdl3y

Description

@Gawdl3y

Is your feature request related to a problem? Please describe.
With CSS layer usage becoming more prominent, it would be useful to be able to specify a CSS layer (or layers) to use for the styles auto-inserted by this module. Perhaps somewhat more critically, FontAwesome's sr-only utilities conflict with Tailwind v4's similar utilities due to Tailwind v4 using layers for all of its styles and FontAwesome not doing so. That's easily solvable in a less fancy setup with manually imported CSS (without tree-shaking), but isn't so much with this module currently.

Describe the solution you'd like
I would like this module to either wrap its auto-inserted styles in a CSS layer by default, or allow for specifying a layer to use for them through some form of configuration.

Describe alternatives you've considered
Not sure of any viable alternatives that don't involve just ditching layers.

Additional context
See this discussion on Tailwind's repo for the aforementioned conflict between Tailwind v4's sr-only and FontAwesome's sr-only. Due to Tailwind v4's utilities being in a layer and FontAwesome's not being in a layer, FontAwesome's sr-only always ends up overriding Tailwind's unless you either manually import FontAwesome's CSS with a layer specified (not currently possible with this module AFAIK) or manually import Tailwind's utilities without a layer (potentially problematic).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions