question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature suggestion] Copy property value from a given selector

See original GitHub issue

I was thinking that it would be great if we had a way of copying values from other properties by passing a selector. Here’s how I can imagine this being used:

.icon {
  content: "";
  display: inline-block;
  width: 16px;
  height: 18px;
  // Since the value is the same, we can just reference it.
  line-height: &.height;
}

// Referencing body values.
.my-content {
  background: body.background;
  color: body.color;
}

Or maybe having something like @value, IDK.

I know this can be accomplished by using variables but it could be useful anyway.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
lolmauscommented, Nov 1, 2016

@SamHH #109 is still open, you can try adding your suggestion there.

0reactions
samhhcommented, Nov 1, 2016

@nex3 Closed and old issue I know, but I can’t find an open and relevant issue for this. Here’s an example of where Stylus bests Sass because of property lookup:

Sass:

$needless-var: 200px
.class
  width: $needless-var
  height: $needless-var

Stylus:

.class
  width: 200px
  height: @width

It’s not a big deal but I think it helps a lot with readability. Whereas with a var you can’t immediately visually grep how often a var is used (and what the consequences are of changing it), you can immediately tell with a property lookup that there is a direct connection between two properties that doesn’t affect anything else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compatible property types for copying values with workflows
There are two types of date properties in HubSpot: date picker properties and datetime properties. You can copy values between both types.
Read more >
c# - Apply properties values from one object to another of the ...
This short and simple Extension method will allow you to copy matching properties from one object to another with the check of Null...
Read more >
To Copy Properties From One Object to Other Objects
Click Home tab > Properties panel > Match Properties. Find; Select the object from which you want to copy properties.
Read more >
CSS selectors - Learn web development | MDN
It is a pattern of elements and other terms that tell the browser which HTML elements should be selected to have the CSS...
Read more >
Using $select, $expand, and $value in ASP.NET Web API 2 ...
The following request gets a property in OData format. Console Copy. GET http://localhost/odata/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found