Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use var() or @var() inside Math functions #30

Closed
martitv opened this issue Jul 2, 2018 · 6 comments
Closed

Can't use var() or @var() inside Math functions #30

martitv opened this issue Jul 2, 2018 · 6 comments

Comments

@martitv
Copy link

martitv commented Jul 2, 2018

for example:

--t: calc(3/2);
--tt: calc(@ceil(var(--t))*4); #Problem here!
margin: calc(.1em * var(--tt));

Doesn't work.

@yuanchuan
Copy link
Member

Currently css-doodle lacks a way to read custom properties

@martitv
Copy link
Author

martitv commented Jul 2, 2018

Alright. Is this feature on the horizon?

@yuanchuan
Copy link
Member

Yeah, I can see it's quite useful sometimes. Will be added soon!

@martitv
Copy link
Author

martitv commented Jul 3, 2018

Ok, nice.
Is this the reason it's not possible to use functions inside things like @Keyframes aswell? e.g.

@keyframes test {
    0% {
      background: transparent;
    }
    calc(50%+@index()) {
      background: black;
    }
}

Would also be really cool to have.

@yuanchuan
Copy link
Member

Not quite.. but it's nice to have dynamic values inside keyframes too :)

@yuanchuan
Copy link
Member

yuanchuan commented Sep 10, 2023

5 years later..

Since 0.37.0, the new symbol $ is added for reading numeric variables.

--t: calc(3/2);
--tt: calc(@ceil(var(--t))*4); #Problem here!
margin: calc(.1em * var(--tt));

Can be written as:

--t: $(3/2);
--tt: $(ceil(4 * t); 
margin: $em(.1 * tt);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants