1

I'm doing some class extensions in Less, but it's silently failing if the class I attempt to extend isn't found. I'd really like to see a warning about that. Is there a way to enable it?

.foo {
    &:extend(.bar); // .bar is undefined, fails silently
}
keithjgrant
  • 12,421
  • 6
  • 54
  • 88
  • `lessc` itself emits failed `extend` warnings since v2.3.0 (by default, no special options for this). Any tool that uses Less compiler programmatically should implement a dedicated support for warnings though before you can see them there. – seven-phases-max Jul 31 '15 at 17:36
  • Hm. Using grunt-contrib-less 1.0.1 which has less 2.4.0. Running the bin/lessc from the node_modules gets me no warnings. – keithjgrant Jul 31 '15 at 17:43
  • That's what I mean with "Any tool that uses Less compiler programmatically should implement a dedicated support for warnings though before you can see them there.". AFAIK no tool supports warnings emitted by Less library yet. As for `bin/lessc` - retest (assuming you have proper version). – seven-phases-max Jul 31 '15 at 17:48
  • I executed the binary directly. No warnings: `./node_modules/grunt-contrib-less/node_modules/less/bin/lessc test.less > test.css` – keithjgrant Jul 31 '15 at 17:51
  • `lessc test.less > test.css` - wrong command-line. The proper command line is `lessc input.less output.css`... `>` is for redirecting console output to files, and it's not being just redundant but also harmful in this case. (in v2.5.x the warning works though even with `>`, as it was dediced to push it harder through `stderr`). – seven-phases-max Jul 31 '15 at 17:59
  • Ah, thanks! That did it. Put your first comment in an answer & I'll accept it. – keithjgrant Jul 31 '15 at 18:10

1 Answers1

1

Less emits "extend fails" warnings by default since v2.3.0. Though by the time I'm writing this, only lessc itself shows these warnings. Other tools (e.g. gulp-less, grunt-contrib-less etc., i.e. those that use the Less library programmatically) need to explicitly implement a dedicated support for such warnings (there was no "warnings-facility" in Less before) and so far none actually did this yet.

seven-phases-max
  • 11,765
  • 1
  • 45
  • 57