Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Add at-rule support – as in firefox implementation #233

Closed
@jakob-e

Description

@jakob-e

The following example does not work in cssnext as opposed to the firefox implementation

// Define color
:root { --color: tomato; }

// Assign the color variable
body { background-color: var(--color); }

// Re-define color in different media queries. 
// Note how we do NOT reference body!    
@media (max-width: 960px){ :root { --color: gold;    } }
@media (max-width: 640px){ :root { --color: olive;   } }
@media (max-width: 420px){ :root { --color: skyblue; } }

Error thrown

Custom property ignored: not scoped to the top-level 
:root element (:root { ... --color: ... }), in atrule

Expected CSS3 output:

body { background-color: tomato; }
@media (max-width: 960px){ body { background-color: gold; } }
@media (max-width: 640px){ body { background-color: olive; }}
@media (max-width: 420px){ body { background-color: skyblue; }}

Example (view in firefox)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions