4

Visual Studio generates an empty .css file when I compile a .less file. I have this problem in both Visual Studio 2015 and 2017. The file is being compiled because I just wrote something and I can see that it removes the text and overrides it with the empty content.

There are also no error during the compilation. I have Web Essentials and Web Compiler installed (the latest versions because it's updates automatically). I've checked for validation on external online less validators with no errors.

I also tried creating a new .less file and compile it, I get the same empty generated css file.

5
  • Does it compile from the command line? lessc yourfile.less > output.css Commented Jun 9, 2017 at 8:02
  • @Demnogonis I opened the Visual Studio 2017 developer command prompt and try just to enter "lessc" command but it's not recognized as a command. Commented Jun 11, 2017 at 11:05
  • 1
    Ok so VS seems to bring its own less compiler. I recommend installing node.js and then installing less via npm (guide from the docs). Then you'll have the latest version of less available. I'm guessing that you can configure Visual Studio to use that instead. Commented Jun 12, 2017 at 7:39
  • @Demnogonis I installed the node.js and less compiter and created a batch file to compile. Is there any easier way to achieve it or automate the compilation each time I save a file in visual studio? Commented Jun 15, 2017 at 11:33
  • 1
    I don't know about visual studio since I'm mostly working with sublime text. I'm using grunt for my buildchains. But this is also an external tool. But I'm guessing there is a way to tell visual studio to invoke an external command when a file is saved Commented Jun 15, 2017 at 12:58

1 Answer 1

1

According to https://github.com/madskristensen/WebCompiler/issues/299 you have to build/rebuild explicitly or right-click on the less file and build. It doesn't happen automatically on save any more.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.