javascript - Lesscss Mixins with guards. Syntax Error -


i write css lesscss using on client side (with compiler less.js).

there examples guards usage in documentation, don't work me. can't understand, why...

code example goes here:

@import "common-functions.less";  // variables @minheaderwidth: auto; @maxheaderwidth: 1200px;  @minbuttonswidth: 50px; @maxbuttonswidth: 75px;  // mixins guards .applyheaderstyles(@headerwidth, @buttonswidth) when (ispixel(@headerwidth)) {     .my-headerelement {         width: @headerwidth;     } } .applyheaderstyles(@headerwidth, @buttonswidth) when not (ispixel(@headerwidth)) {     .my-headerelement {         width: @headerwidth;         margin: 0 @buttonswidth;     } }  // use .applyheaderwidth in @media queries @media screen , (min-width: 1050px) {     .applyheaderstyles(@maxheaderwidth, @maxbuttonswidth);     .my-buttonelement {width: @maxbuttonswidth;} } @media screen , (max-width: 1049px) {     .applyheaderstyles(@minheaderwidth, @minbuttonswidth);     .my-buttonelement {width: @minbuttonswidth;} } 

code writen documentation. doesn't work. when execute code, have syntax error:

 syntax error on line 10 [link file] on line 10, column 58: 10    // mixins guards 11    .applyheaderstyles(@headerwidth, @buttonswidth) when (ispixel(@headerwidth)) { 12        .my-headerelement { 

as mentioned here, updating less.js 1.2.2 solves problem.

from changelog:

1.2.0 mixin guards 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -