Skip to content

@import with media query produces incorrect output when the imported file is a entry point #1503

@silverwind

Description

@silverwind

Feature Proposal

Support @import list-of-media-queries syntax. Currently the plugin ignores and strips the media query from the output, making runtime-conditional import impossible without additional plugins.

Feature Use Case

@import "./dark.css" (prefers-color-scheme: dark);

Currently the plugin outputs the content of dark.css file without any media query condition, so the CSS is applied unconditionally at runtime:

/* content of dark.css */

A better output would be:

@media (prefers-color-scheme: dark) {
  /* content of dark.css */
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions