Comments (6)
This would be good, but can severely compromise the performance.
from vunit.
I'm re-opening this issue since it's an important one. Hard to work it out without rewriting the library from scratch.
from vunit.
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.
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.
@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.
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)
- Firefox for Android doesn't calculate the height correctly on page load
- Add to cdnjs
- *Feature* -- Adding support by Property to Chrome Bug HOT 1
- Performance Problem HOT 4
- Padding problem HOT 2
- Font-size properties HOT 6
- Can vunit overcome the problems that surround treating a page segment as a viewport? HOT 6
- The fork button on your site is redirecting to a 404
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vunit.