3

Each time I have a .less syntax error I have to open the exact less file in browser in order to view the error message.

I was wondering if it is possible to somehow output .less errors to console so I can view all errors directly in the Console log when - for example - using Firebug?

I'm using dotless. I tried setting the webconfig to (by following info this link )

<dotless minifyCss="false" cache="false" web="false" log="error" logger="dotless.Core.Loggers.ConsoleLogger" />

but seems like I'm missing something - not really sure, if I understand the logger correctly.

Also the info about logger on the site states:

Can be set but then gets overidden by the "web" boolean

Does this mean that I must not set the web boolean? How could I make this work?


EDIT AFTER FEW ANSWERS

Ok so I figured out that in order to achieve this result I need to extend dotless.Core.Loggers with my own logger class. Have no idea how to do it but will report back once I get it figured out.

easwee
  • 15,757
  • 24
  • 60
  • 83

2 Answers2

2

If you're using Visual Studio, you can try using Web Essentials extension, which is free on the gallery. This add-in compiles .LESS on save, and gives you the errors in the output console. You can also see the compiled .css side-by-side as as you edit the .LESS.

Giscard Biamby
  • 4,569
  • 1
  • 22
  • 24
  • I already get errors displayed on build - I want to display them in browser console log. – easwee Dec 31 '12 at 13:50
  • Sorry i misunderstood. I replied after reading the first sentence of your question. If you get LESS errors on save (not build), why would you still want to see them in the browser? Doesn't getting them on save give you faster feedback, since you don't have to build, run, and then refresh the site in your browser? – Giscard Biamby Dec 31 '12 at 14:05
  • I often have to debug projects of other programmers - each pc runs on windows server and each pc runs a local copy that can be accessed directly on their pc as they work - so I can see their live progress. I don't want to have to walk to another office and check their build logs once they got screwed, I want to see the errors in the browser console log on my pc. – easwee Dec 31 '12 at 14:29
  • 1
    Ah. Isn't ConsoleLogger writing to the system console (e.g., `Console.WriteLine()`)? To get errors output to the browser console you'd have to do something like create your own logger class that outputs the error messages in the form of a javascript file that issues javascript console.log() commands to output the messages to the browser console. – Giscard Biamby Dec 31 '12 at 16:33
  • Yeah I downloaded the source files now and went trough all loggers - to bad there's no class for my case - will try and write my own class - let's hope I can make it - I'm no hardcore programmer but shouldn't be much harder than javascript alone :) Thanks - you really helped me out. – easwee Jan 03 '13 at 15:22
  • Although this does not solve my problem directly you pointed me in the right direction and gave a good tip on what to do, so I'm awarding this bounty to you. If I manage to solve this myself I'll update this question with my own solution. – easwee Jan 07 '13 at 08:02
2

It looks like a similar question has already been answered here

In any case, looking at the link you indicated, it makes it clear that you need to set web="true" or miss it out as it seems to be the default.

ConsoleLogger means the Console, not the browser console.

So, you need to set the logger to the one you prefer that works with HTTP (definitely not Console though).

Community
  • 1
  • 1
The Bearded Llama
  • 3,036
  • 4
  • 20
  • 31