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

variables in property names? #411

Closed
geddski opened this issue Sep 29, 2011 · 4 comments
Closed

variables in property names? #411

geddski opened this issue Sep 29, 2011 · 4 comments

Comments

@geddski
Copy link

geddski commented Sep 29, 2011

I'm trying to write a mixin that lets me dynamically set a property based on a mixin argument. Here's what I'm trying to do:

.round-corner (@corner, @radius){
   `'border-' + "@{corner}" + '-radius'` : @radius;
}

//example use
.round-corner(top-left, 20px); ---> border-top-left-radius: 20px;
.round-corner(top-right, 10px) ---> border-top-right-radius: 20px;

I've tried a number of ways, above is using JavaScript (ticks) but it doesn't work. Is this supported?

@ttfkam
Copy link
Contributor

ttfkam commented Sep 30, 2011

Not currently. Variables are only valid as values.

@waiting-for-dev
Copy link

Would be a great improvement to allow variables in properties names

@jmgunn87
Copy link

yes variable variables would be a great addition.

@lukeapage
Copy link
Member

duplicate of #36

stefanklug pushed a commit to stefanklug/carto that referenced this issue Jan 27, 2019
stefanklug pushed a commit to stefanklug/carto that referenced this issue Jan 27, 2019
stefanklug pushed a commit to stefanklug/carto that referenced this issue Jan 27, 2019
… to test for strings that begin with a number, but shouldn't be treated as one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants