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

Add support to decimal values / floats #3

Open
erisoftdevelop opened this issue Mar 29, 2015 · 6 comments
Open

Add support to decimal values / floats #3

erisoftdevelop opened this issue Mar 29, 2015 · 6 comments

Comments

@erisoftdevelop
Copy link

Actual code does not provide a right way to set decimal vh or vw values.
Sometimes is required because content needs to be adjusted in not integer values.

I suggest something like this:

.vw_font-size15 -- As actual code does 15% of vw.
.vw_font-size15_35 -- As 15.35% of vw.

@joaocunha
Copy link
Owner

This would be good, but can severely compromise the performance.

@joaocunha
Copy link
Owner

I'm re-opening this issue since it's an important one. Hard to work it out without rewriting the library from scratch.

See #5, #10 and #11.

@joaocunha joaocunha changed the title *Feature* -- Adding support to Decimal Values Add support to decimal values / floats Feb 4, 2016
@joaocunha joaocunha reopened this Feb 4, 2016
@gkusnir
Copy link

gkusnir commented Feb 7, 2016

Maybe you could give up the universality for resolution. What I mean:
you recalculate the values every time for all the 100 possible integer percentage values,
but if a single page uses just a few elements based on viewport values
there could be a cssmap property to pass an array of the class names with corresponding
values (float) and the reference (vh, vw...).
If the property is defined in cssmap then calculate for these values only, if not do the job as now
with integers only.
It would have an advantage of not using more classes in the markup but reusing them.
For example a class .thirdpageheader which I want to be 33.33% of the viewport vh could be used
in cssmap as ".thirdpageheader": {prop: "height", ref: "vh", value: 33.33}

@gkusnir
Copy link

gkusnir commented Feb 7, 2016

I just realized a possible solution:
In createCSSRules function you could skip the for loop if the map[selector].value
would be defined and numeric and create just one rule for this selector instead of 100.
So the script would be backward compatible with a new functionality
and even better performing is some situations.

@joaocunha
Copy link
Owner

@gkusnir that is an interesting approach, but it would make the API quite confusing. I would love to allow devs to simply write classes and let the lib handle it.

@Shebo
Copy link

Shebo commented Feb 9, 2016

What about giving the user control over the lib performance?
The user already need to write a class, and to define it upfront with which classes he needs, so why not give him some control over the lib and in most cases perform better?

a. let users define in a boolean property if they want float classes.
b. let the user set a array/range of values he wants to create classes to them (anyone who uses it for fonts will probably won't need classes above 20).

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

4 participants