Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore certain LESS files in Web Essentials LESS compiling? (Bootstrap)

I've set up Web Essentials 2013 (in Visual Studio 2012) and loaded in the default Twitter Bootstrap LESS source files. Auto-build and minification is working perfectly, except Web Essentials quite overdoes the job. When I select "bootstrap.less", make a change and save it, Web Essentials creates a new "bootstrap.css" as well as a "bootstrap.min.css" with everything inside I need. But when I edit e.g. buttons.less, it creates a buttons.css (and buttons.min.css) too (with all the includes and mixins). Which means, in fact, I'll have nearly the same css files over and over again under different names.

Can I declare certain files to be ignored on save?

like image 642
Acrotygma Avatar asked Oct 06 '13 19:10

Acrotygma


2 Answers

There is a convention in Web Essentials that if the name of your less file starts with an underscore (like _utils.less) it will not be compiled to css on save.

https://webessentials.uservoice.com/forums/140520-general/suggestions/3319359-don-t-compile-nested-less-files

like image 101
corvuscorax Avatar answered Oct 29 '22 12:10

corvuscorax


Okay, I figured it out.

What I initially wanted was LESS compilation on build, Web Essentials was so kind to do this on save. To deactivate this, in Visual Studio 2012 head over to Tools -> Options -> Web Essentials -> LESS and deactivate "Generate CSS file on save".

a busy cat

According to the Visual Studio Extension page for Web Essentials, minification on build works not by now, but will on future releases. I have to delete the .min.css files by myself and create it again on every build as it seems. :(

Pro-tip for every dev:

If you use any framework, tools, extensions etc. and your new super-powers don't work as expected, don't blame the extension, shut up and do it yourself.

like image 38
Acrotygma Avatar answered Oct 29 '22 12:10

Acrotygma