8

I have installed Visual Studio 2015 and, since Web Essentials won't compile .less files anymore, I installed the Web Compiler add-on for compiling .less files.

The issue is that I can't seem to set it up to auto-compile the .less file into .css on save. What can be done for compiling the .less files on save?

alex
  • 6,818
  • 9
  • 52
  • 103
kerki
  • 125
  • 2
  • 5

2 Answers2

9

I use Web Essentials with Visual Studio 2015 when using Less. Web Essentials for Visual Studio 2013 has the built-in feature that compiled your .less file into a .css and .min.css file, and it also had the feature to update the .css and .min.css files when you save your .less file.

Now with VS 2015, I had to download two seperate add-ons to get this feature back: Web Compiler and Bundler & Minifier

I thought my Visual Studio/Web Essentials add-on was broken... Bundler & Minifier should fixed the auto-save issue for you, it did for me :)

hatsrumandcode
  • 1,871
  • 2
  • 19
  • 21
  • I had Web Essentials and Bundler & Minifier installed and still had the problem. Installing the Web Compiler add-on as well seems to be mandatory. – pistol-pete Jul 28 '16 at 17:44
  • You might find that even after installing Web Compiler it doesn't compile on save. If so, delete the `%localappdata%\temp\WebCompler???` folder. Sometimes you need to restart VS, sometimes you don't. Doesn't work for everyone, but seems to work for a lot of people – Avrohom Yisroel Jun 08 '17 at 15:29
  • check for errors in your .less files also (not always clear) .less file with errors will not generate css file. – Dafmeister Aug 14 '17 at 15:44
0

now with VisualStudio 2015 you have to use a task manager like Gulp or Grunt. These tools are NPM packages which can be executed in visual studio with the "task runner explorer"

By example, try to implement (with the complete tutorials on my links) Gulp with the "gulp-less" module to compile your less files, then you can attach your gulp execution with some events of Visual Studio ( like pre-build, post-build .. etc ) or you can use "gulp-watch" to check when you save a less file and automatically compile them.

Kevin ALBRECHT
  • 494
  • 4
  • 13
  • thanks for the answer - from where do I download gulp-watch? – kerki Dec 17 '15 at 09:56
  • https://www.npmjs.com/package/gulp-watch here is the documentation, but i'm not sure if Gulp will install it for you if you write your gulpfile.js with : var lessCompile = require("gulp-less"); – Kevin ALBRECHT Dec 17 '15 at 10:12