Skip to content

Please clearly show in the README the limitation / bugs it can create #4

@MoOx

Description

@MoOx

Currently you use a title like

.root {
  --text-color: red;
}

.component {
  --text-color: blue;
}

.component .header {
  color: var(--text-color);
}

.component .text {
  --text-color: green;
  color: var(--text-color);
}

With the current html, this is completlly wrong

<div class="component">
  Black
  <div class="header">
    Blue
    <div class="text">
      Green
      <div class="header">Green</div>
    </div>
  </div>
</div>

See native result on firefox http://jsbin.com/tireneluxo/1/edit?html,css,output

Your output give a completly different result

http://jsbin.com/zacakilamo/1/edit?html,css,output

It's unexpected according to what I can read in the readme https://github.com/MadLittleMods/postcss-css-variables#using-cascading-variables-the-var-notation

Using Cascading Variables: the var() notation
...

  • No limitation on what scope CSS variables can be declared or used (:root or wherever)
  • Proper value substition based on explicit DOM/structure traversal

So it's totally unclear.

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