less

Conditional Imports in Less

谁说我不能喝 提交于 2019-12-13 03:34:27
问题 I've tried two ways of doing optional imports but neither seems to be working. Is this possible as of less 2.6.0? @useRTL: true; & when (@useRTL = true) { @import "bi-app/bi-app-rtl.less"; } @useRTLpath: "bi-app/bi-app-rtl.less"; @import (optional) "@{useRTLpath}"; 来源: https://stackoverflow.com/questions/35460595/conditional-imports-in-less

LESS parent selector for first parent

核能气质少年 提交于 2019-12-13 02:01:06
问题 From documentation about changing selector order we can see this example: .header { .menu { border-radius: 5px; .no-borderradius & { background-image: url('images/button-background.png'); } } } and result will be .no-borderradius .header .menu {} How to use parent-selector & to get selector .header .menu.no-borderradius without duplicating code: ul { li { a { .active &, &:hover { color: red; } } } } will provide CSS .active ul li a {color: red;} but required result is ul li.active a {color:

Make LESS remove useless IDs when compiling

社会主义新天地 提交于 2019-12-13 02:00:14
问题 One feature I really love with LESS is nested rules. It makes the stylesheet much cleaner that way and you can find an element very quickly. I was wondering if there's an option when compiling to optimize selectors. For example... #global { /* Styles here maybe */ .container { /* Styles here maybe */ #sidebar { /* Styles here maybe */ .title { font-weight: bold; } } } } will be compiled to #global .container #sidebar .title { font-weight: bold; } . But the first two selectors are useless,

How to customize Thelia template with less?

僤鯓⒐⒋嵵緔 提交于 2019-12-13 01:53:44
问题 I imported the project into WebStorm 8 but when I try to change vales into .less files WebStorm give me this error: /usr/local/bin/lessc --no-color import.less NameError: variable @screen-desktop is undefined in /Users/iulianrusu/Sites/thelia/templates/frontOffice/default/assets/less/thelia/variables.less on line 11, column 37: 10 // Grid system 11 @grid-float-breakpoint: @screen-desktop; 12 Process finished with exit code 2 Does anybody know the easier way to modify the default theme? 回答1:

How to make BundleTransformer work on Windows Server Core

不羁岁月 提交于 2019-12-13 01:35:02
问题 Ever since we found dotLess stopped working for us our ASP.NET MVC project has been using BundleTransformer for our LESS bundling and minification. We are trying to migrate our CI build agents to use Windows Server Core (headless) and away from Windows Server Standard. When we did this we started receiving Internal Server Errors when trying to hit our pages. This seems to be blowing up inside of BundleTransformer. We initially were using BundleTransformer with http://www.nuget.org/packages

Simple style change does not apply

孤街醉人 提交于 2019-12-13 01:28:54
问题 I've followed the first part of this guide by: Creating and applying my own theme. Using the web/css/source/_extend.less that's on the guide. Deleting the mentioned directories. Refreshing the page. But the button style did not change. What am I missing? 回答1: Login to admin, go to System -> Cache Management in the bottom of the page you could see the three flush cache button option. click the JS/css and static flush cache button then clear the cache of your browser also. load the page it will

Less variables scopes/contexts

江枫思渺然 提交于 2019-12-13 01:25:34
问题 My less code is something like this: body { @var: white; &.blue { @var: blue; } &.red { @var: red; } &.abc { @var: #badass; } background-color: @var; } What I hope is, if the body has the class .abc the value of the variable @var is #badass , if you have the class .blue The value is blue and so on. But that's not what happens, the value of the variable dont change independent of their remains classes. 回答1: You need to create a parametric mixin for that: .bg(@color){ background-color:@color; }

How to re-use a mixin whose selector is formed using concatenation

喜你入骨 提交于 2019-12-13 00:45:11
问题 In Less, I can write: .outer { .inner { color: red; } } .test { .outer .inner; } But when I write: .outer { &-inner { color: red; } } .test { .outer-inner; } When I remove the .test , the .outer-inner output properly, but when I add it back, the compiler says .outer-inner is undefined. Is there anyway to re-use the styles of .outer-inner ? 回答1: Calling a mixin whose selector is formed by concatenation is currently not possible with Less. However the same is possible for selectors formed at

Sails js application driving CPU usage to 100%

霸气de小男生 提交于 2019-12-12 22:08:00
问题 I'm building a an application using sails and every time I leave the server running for more than a few minutes my CPU jumps to a solid 100% usage. I'm including a big amount of less files in my assets and I believe my issue lies here. Are there any other reasons this may happen? 回答1: It could be the grunt-watch, when you have a lot of files it squeezes your cpu. Try disabling that and check if your cpu gets to a normal usage (6-30% depending on your cpu and overall usage). To do that go to

Conditional CSS based on background color variable inside loop

回眸只為那壹抹淺笑 提交于 2019-12-12 20:34:53
问题 I realise this is a similar question to this Conditional CSS based on background color variable but I need to do it inside a loop in LESS. If a background colour is too dark I want to generate another class so I can make the text on top lighter but not sure how as I don't think you can use lighten and darken functions with hex colours...? Here is my LESS http://codepen.io/anon/pen/IlsJE?editors=110 .for(@i, @n) {.-each(@i)} .for(@n) when (isnumber(@n)) {.for(1, @n)} .for(@i, @n) when not (@i