Skip to content
This repository has been 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 opened this issue Nov 14, 2015 · 1 comment
Closed

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

jakob-e opened this issue Nov 14, 2015 · 1 comment

Comments

@jakob-e
Copy link

jakob-e commented Nov 14, 2015

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)

@MoOx
Copy link
Owner

MoOx commented Nov 14, 2015

Closing in favor of postcss/postcss-custom-properties#9

@MoOx MoOx closed this as completed Nov 14, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants