Git Product home page Git Product logo

Comments (8)

leafo avatar leafo commented on September 16, 2024

I like both of these ideas. The only issue I see is that special IE functions already support the syntax but the compiler would output in rgba()

eg.

filter: progid:DXImageTransform.Microsoft.gradient(enabled='false', startColorstr=#550000FF, endColorstr=#55FFFF00);

would turn into

filter: progid:DXImageTransform.Microsoft.gradient(enabled='false', startColorstr=rgba(85,0,0,1), endColorstr=rgba(85,255,255,0));

do you think that would be problem?

from lessphp.

jtousek avatar jtousek commented on September 16, 2024

Yeah I'm thinking about this to. Is it possible to detect the context of usage rgba color? If it is IE filter, return the filter syntax, else rgba(...);?

By the way thanks for implementing all of my ideas! ;)

from lessphp.

jtousek avatar jtousek commented on September 16, 2024

Actually it would not... Less cann't see colors used in filter. Can I somehow use a variabli in filter value? I couldn't figure it out.

from lessphp.

jtousek avatar jtousek commented on September 16, 2024

Is there any way to know, what property is being compile in lessc::compileValue method? That could solve this problem with filter. There is also similar issue with -webkit-border-radius.

from lessphp.

jtousek avatar jtousek commented on September 16, 2024

Well apparently not. But we could do something like this:

  $property = '';

  function compileProperty($name, $value, $level = 0) {
    foreach ($value as $v) {
      $this->property = $name;
      $props[] = str_repeat('  ', $level).$name.':'.$this->compileValue($v).';';
    }
    return implode("\n", $props);
  }

Then we can simply test variable $this->property in compileValue method. It is an ugly hack, but I noticed that compileValue is called from many places, so it might be a problem to do this through second parametr of compileValue. What do you think?

from lessphp.

leafo avatar leafo commented on September 16, 2024

I would tell what I am currently in by pushing the name of what I am entering on a stack at the start of compile value, and then popping it at the end. (the name of the property shouldn't matter, we just need to know that we are in a microsoft specific function in the value)

from lessphp.

jtousek avatar jtousek commented on September 16, 2024

Not only. Like i've said, there is also some difference between -webkit-border-radius and (-moz-)border-radius. For example:

/* this is equivalent: */
-webkit-border-radius:  40px 10px;
-moz-border-radius:  40px/10px;
border-radius:  40px/10px;

It's copy + paste from this site:
https://developer.mozilla.org/en/CSS/-moz-border-radius

from lessphp.

jtousek avatar jtousek commented on September 16, 2024

Ok, I've solved border-radius issue by mixins. But what with those filters? Without solution to this filters are limited to rgb. Well i think we have 2 options - some global flag whether we are in filter property or second argument for compileValue method (with same purpose).

from lessphp.

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.