less

DotLess LessCss compiler is different to WebEssentials LessCss compiler

让人想犯罪 __ 提交于 2019-12-11 06:16:46
问题 I'm using dotless to parse LessCss at runtime. This is mostly successful but I have one scenario where it doesn't work as intended. Given the following LessCss: @tileWidth: 50px; @tileMarginX: 5px; @gridWidth: 2; // recursive less to generate all x positions down to 1 .position-x(@maxIndex) when (@maxIndex > 0) { [data-col="@{maxIndex}"] { left: ((@maxIndex - 1) * @tileWidth) + (@tileMarginX * ((@maxIndex * 2) - 1)); } .position-x(@maxIndex - 1); } .position-x(@gridWidth); WebEssentials 2013

CSS Selector Chain Performance

五迷三道 提交于 2019-12-11 06:03:48
问题 I will try to explain my question with a little bit of CSS Option 1 I don't repeat the float:left; all over the place, instead I chain all the class names that are going to float left together. .one-little-thing, .two-little-things, .three-little-things, .four-little-things, .five-little-things { float:left; } .one-little-thing { color: blue; } .two-little-things { color: red; } .three-little-things { color: yellow; } .four-little-things { color: blue; } .five-little-things { color: green; }

LESS mixins vs classes

核能气质少年 提交于 2019-12-11 05:51:33
问题 I'm looking into LESS because I definitely see some of their benefits. For instance colour declaration. One thing I don't understand tho, and maybe I'm not getting the flow right is - why use the following LESS snippet .radius { -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } .btn-red{ background-color:red; .radius; } .btn-green{ background-color:green; .radius; } ... When we can use the .radius class in the html file right away. I'm left with the impression that LESS

Scoping CSS / Prepend selector with LESS

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 05:47:09
问题 I have a chunk of CSS that I want to "scope" to a specific block of HTML. I'm generating a unique ID and then setting it on the block of HTML and then would like to wrap the chunk of CSS with the same ID so that those selectors can't match sibling or parent elements. I don't know the contents of the chunk of CSS. Given a chunk of CSS: .container { background-color: black; } .container .title { color: white; } .container .description { color: grey; } I need it to come out like this: .theme0

LESS svg-gradient() function with multiple variables

不羁岁月 提交于 2019-12-11 05:03:59
问题 I cannot seem to send multiple variables to the svg-gradient() function in less. If I don't use variables, the svg-gradient function works fine. (Except for the non-increment of ids - but that's something else entirely!) Or if I send the exact same data to the CSS property, linear-gradient(), which is the same format that the svg-gradient() function requires, it works also. Can anyone tell me why the commented lines in the code below are not successfully compiling when the ones above and

Apphabor gives 404 on bootstrap.less

安稳与你 提交于 2019-12-11 05:03:42
问题 I have deployed a simple .NET MVC application on appharbor that implements bootstrap and less. The less loads fine on my localhost instance when i run it, however, when i push it to appharbor i get a 404 on bootstrap.less. Has anyone run into this before that might be able to tell me why? I have checked the buildout and the less directory/file structure exists on the deployment. The appharbor url is http://appharbor-bootstrap.apphb.com/ if anyone wants to check out what im seeing. Source can

creating a less bundle with webpack

拥有回忆 提交于 2019-12-11 04:46:29
问题 I need to create a bundle.less file with webpack that behaves the same as less-loader + exctract text plugin EXCEPT that it should not compile less into css, only concatenate all the required less files and inline the less imports. The reason is that I have some variable that will be resolved at runtime (to allow the user to customize the application theme) but I want to ship in production bundled resources instead of the whole source file collection. Is there a way to do that with existing

Conditional mixin based on parameter existence

。_饼干妹妹 提交于 2019-12-11 04:39:42
问题 Any suggestion how to create a conditional mixin based on parameter existence? For example I need to to verify that all the parameters are passed in order to perform something or not, for example: .margin (@margintop:0,@marginbottom:0,@marginright:0,@marginleft:0) { // if @marginright:0 or @marginleft:0 are passed do that... // else... } 回答1: 1: In general, when you need to generate different things for different number of arguments passed you don't need to use default argument values at all,

less css variable defined by function multiple executions

孤街浪徒 提交于 2019-12-11 04:27:59
问题 I have a css variable being defined by a randomizer function, I need this variable to generate a random background color from the list, every time I enter the page: @all-background-colors: "#7B8AA8,#00ADD5,#E93C43,#FC8383"; @background-color: color(~`@{all-background-colors}.split(',')[Math.floor(Math.random()*@{all-background-colors}.split(',').length)]`); However it seems that the function gets executed every time I use this variable in my css - resulting in many different colors being used

LESS CSS how to modify parent property in mixin

删除回忆录丶 提交于 2019-12-11 03:53:59
问题 I'm looking for a less syntax to do something like that: .button-default{ background-color: rgb(100,200,250); :hover{ .button-hover-effect-mixin(); } } .button-warning{ background-color: rgb(250,100,0); :hover{ .button-hover-effect-mixin(); } } .button-hover-effect-mixin(){ background-color: darken(PARENT.background-color, 50%); } I know how to do that with a parameter or a global variable but the hover-effect schould not always be designed to change the background-color. 回答1: If you mean the