Giter Club home page Giter Club logo

Comments (10)

MoOx avatar MoOx commented on June 1, 2024

What is the point of this? Browser that will understand vw probably understand calc().
And not even sure this is correct. vw is a dynamic unit, I don't know how you end up with this weird result.
Could you add some details?

from postcss-calc.

dikmax avatar dikmax commented on June 1, 2024

Point is minimization. Maybe it's better to move this ticket to cssnano. But then I thought which project suits better I choose this one, cause it does almost same thing.

from postcss-calc.

MoOx avatar MoOx commented on June 1, 2024

Can you provide detail about the algorithm here? Or just how you end up with this result. I am not following the result your mentioned.

from postcss-calc.

dikmax avatar dikmax commented on June 1, 2024

That's quite easy, just distributive property applied.

  14px + 6 * ((100vw - 320px) / 448) =
= 14px + 6 * ((100/448)vw - (320/448)px) =
= 14px + (6*100/448)vw - (6*320/448)px =
= (6*100/448)vw + (14 - 6*320/448)px ≈ 1.3392857143vw + 9.7142857143px

from postcss-calc.

MoOx avatar MoOx commented on June 1, 2024

Not sure that ((100vw - 320px) / 448) can be converted to ((100/448)vw - (320/448)px). That's seems too easy. Did you try the result in a browser just to see?

from postcss-calc.

dikmax avatar dikmax commented on June 1, 2024

Of course, steps in the middle are not working. I've provided them just to show idea of transformation. You have to calculate (0.2232142857vw - 0.7142857143px) to make it working.

from postcss-calc.

dikmax avatar dikmax commented on June 1, 2024

But when it's calculated they provide same result, i've checked.

from postcss-calc.

MoOx avatar MoOx commented on June 1, 2024

Feel free to make a PR to https://github.com/MoOx/reduce-css-calc if you have something solid (a jsfiddle with detailed step would be appreciated as well as test).

from postcss-calc.

ben-eb avatar ben-eb commented on June 1, 2024

Resolved in https://github.com/postcss/postcss-calc/releases/tag/v6.0.0.

from postcss-calc.

ben-eb avatar ben-eb commented on June 1, 2024

Will be resolved for version 4, see https://github.com/postcss/postcss-calc/releases/tag/v6.0.0.

from postcss-calc.

Related Issues (20)

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.