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 {
Comments
Post a Comment