0

I was wondering if it's possible to force grunt to compile LESS even if there is an error?

The reason I ask is I'm outputting settings from the interface (Moodle) into less so that they can be changed by users. When I try to see a colour or do some math it throws errors because it's either expecting an RGBA value or a number value.

An example of the syntax would be:

div{background-color: rgba(0,0,0,~"[[setting:blockboxshadowalpha]]");}

This works fine if I put it directly into the compiled CSS but fails when using the rgba() function or doing something like the following:

a:hover{color: darken(~"[[setting:linkcolor]]", 20%);} 
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Fony Tinlay
  • 59
  • 2
  • 12
  • Unless you create/use a compiler that supports such feature, no, you can't. How would that work? Omit "bad" rules? Include them "as-is"...? Hope you understand why it doesn't make much sense. – walther Jun 25 '15 at 15:30
  • For the `rgba` you could just escape the whole statement, e.g. `~"[rgba(0,0,0,[setting:blockboxshadowalpha]])"`. For `darken` (and any other Less function that does not exist in CSS) this is impossible of course. – seven-phases-max Jun 25 '15 at 15:58
  • Hi @seven-phases-max, unfortunately it doesn't work. I think I may have to find another solution as I need an implementation for several scenarios. I appreciate the help. – Fony Tinlay Jun 30 '15 at 09:29
  • @ThePixelworx: What exactly does not work? `rgba` will work (double check). And `darken` and other non-CSS functions won't and can't work for obvious reasons... You have to rethink the whole approach if you need your users to change colors. – seven-phases-max Jun 30 '15 at 10:21

0 Answers0