Skip to content
This repository has been archived by the owner on Oct 6, 2018. It is now read-only.

Strip units on passed in values to em & rem functions and mixins #80

Closed
stowball opened this issue Apr 15, 2015 · 2 comments · Fixed by #124
Closed

Strip units on passed in values to em & rem functions and mixins #80

stowball opened this issue Apr 15, 2015 · 2 comments · Fixed by #124

Comments

@stowball
Copy link
Collaborator

Currently, the (to)-em and (to)-rem mixins and functions don't handle anything but unitless values.

I'm so used to passing in a px on the end of my string that the output then breaks. It would be great to strip units on whatever was supplied before the calculation.

@kllevin
Copy link
Collaborator

kllevin commented Apr 15, 2015

This feels a bit like over engineering an old habit. Scally was designed to use rems for everything (except maybe borders), it isn’t a great development experience to be thinking in pixels when your framework is using scalable units.

Additionally allowing the user to pass units when they are only going to be stripped away sets false expectations and is confusing. If I write something as specific as 30px, I expect it to be 30px. Stripping the units and converting to-rems or to-ems as these functions are designed to do give the user a result different than they expected. I would argue that it is better to keep everything unit-less and only ever provide a unit when absolutely required, such as with borders as you don’t want those to scale.

@stowball
Copy link
Collaborator Author

But the expectation is the same right? The mixins and functions only actually take pixel values, it just happens to be unitless pixels. If you pass in 13, that means 13px. What you get out of it will still be the same (13/16)rem.

It just makes it a bit more robust imo.

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

Successfully merging a pull request may close this issue.

2 participants