0

I have an element with that have a SCSS custom property with a certain value. and if this value matches a certain regex pattern then do some action.

I want to get that value in javascript. The issue is that I don't want to use getComputedStyle as it will return the parsed value.

E.g, I have a div, the div has a class. In that class contains a custom property with some value, that value is, for example, repeat(1, 1fr).

How can I know that value in Javascript? getComputedStyle will return the parsed value E.g, 100px

Code example:

<div class="test"></div>


body{
  --rows: repeat(2, 1fr)

  .test {
     grid-template-rows: var(--rows);
  }
}
DavSev
  • 1,005
  • 4
  • 22
  • 47

0 Answers0