Giter Site home page Giter Site logo

Comments (6)

joaocunha avatar joaocunha commented on June 3, 2024

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

from vunit.

joaocunha avatar joaocunha commented on June 3, 2024

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.

from vunit.

gkusnir avatar gkusnir commented on June 3, 2024

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}

from vunit.

gkusnir avatar gkusnir commented on June 3, 2024

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.

from vunit.

joaocunha avatar joaocunha commented on June 3, 2024

@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.

from vunit.

Shebo avatar Shebo commented on June 3, 2024

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).

from vunit.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.