lesscss - Are mixins also “Lazy loaded” like variables?


I just found out that variables in less are "lazy loaded" (as discribed here: <a href="http://lesscss.org/features/#variables-feature-lazy-loading" rel="nofollow">http://lesscss.org/features/#variables-feature-lazy-loading</a> ) in the sense that if you set up a variable, use it and then set it to another value the complied code will use that last set value.


@w: 30%; .myclass { width: @w; }

would compile to:

.myclass { width: 50% }

would the same apply to mixins?

i.e. will

.mycolor() { color: red; } .myclss { .mycolor() } .mycolor() { color: blue; }

compile to: (no lazy)

.myclass { color:red; }

or (lazy):

.myclass { color:blue; }


<h2>No, They are not Lazy-loaded</h2>

As noted in a comment, mixins "merge" their values if they have the same name. So your code will produce this:

<pre class="lang-css prettyprint-override">.myclss { color: red; color: blue; }

Which, in the case of calling the same property twice (as your code does), effectively makes the CSS become equivalent to it having been "Lazy-loaded" because the "final" property value is the one used. So the above will be translated by browsers as:

<pre class="lang-css prettyprint-override">.myclss { color: blue; }

But it is not correct to view it as lazy loading, because if other properties are present, they just merge. So:

<pre class="lang-css prettyprint-override">.mycolor() { color: red; opacity: 0.3; } .myclss { .mycolor() } .mycolor() { color: blue; border: 1px solid black; }


<pre class="lang-css prettyprint-override">.myclss { color: red; opacity: 0.3; color: blue; border: 1px solid black; }

True "Lazy-loading" like the variables would have just overwritten the first set of property calls.


  • Bitmap Image not displaying from a URL link Blackberry
  • Angular js ng style not working
  • How do I randomly set the color for a MovieClip in actionscript3
  • Set UITableViewCell background color using a CALayer
  • How do you use pagination in a Django REST framework ViewSet subclass?
  • Ember.js ArrayController error
  • Webpack import multiple less files using glob expressions?
  • How to return a deferred promise and create a model with Ember.Deferred?
  • FromJSON make a list from multiple fields
  • jQuery UI .sortable() call is slow when applies to thousands of elements
  • Move to Web API RC, Get: Method not found: 'System.Web.Http.Services.DependencyResolver System.
  • Boost Spirit Qi Attribute Propagation
  • Declare a C++ class without defining it in the current translation unit
  • Singleton Alternative - is it equivalent?
  • Polymer build not to create bundled and unbundled folder
  • Using constants or global variables in 3 tier console application
  • UIButton Borders Function Only Gives Back White Borders
  • Checking a play current mode makes an error occur
  • Responsive left sidebar open close
  • NUnit 3.0 TestCase const custom object arguments
  • Low TTL with Leveled Compaction, should I reduce gc_grace_seconds to improve read performance withou
  • Creating Java object from class name with constructor, which contains parameters [duplicate]
  • Reduction and collapse clauses in OMP have some confusing points
  • Groovy: Unexpected token “:”
  • MongoDb aggregation
  • How to modify the colors in the legend of a plot using a fill gradient?
  • How to use remove-erase idiom for removing empty vectors in a vector?
  • How to delay loading a property with linq to sql external mapping?
  • Read text file and split every line in MSBuild
  • How to show dropdown in excel using jrxml (jasper api)?
  • jquery mobile loadPage not working
  • WPF Applying a trigger on binding failure
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Acquiring multiple attributes from .xml file in c#
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Qt: Run a script BEFORE make
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • java string with new operator and a literal