Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LESS compiler and relative @import references not working in Web Essentials 2012 v2.7

The update to v2.6 works from with VS 2012 and I have the Web Tools 2012.2 update installed, but a problem that I noticed that does not exist in the v2.5.1 version (I downgraded to fix for now) is that the @import lines in LESS files do not locate the referenced files anymore when compiling.

The compiler bombs unless the file referenced in the @import line is in the same physical folder. If any path information exists, such as "../../style/common.less", the compiler responds with an error and won't create the generated CSS file.

The error that I get is that it cannot find the file and the path information is truncated to either the first parent path construct or none. So, it's looking for "../style/common.less" or "style/common.less". It seems to be intermittent between the two.

For a possibly related issue, see: LESS importing CSS and relative paths

UPDATE: Confirmed that the expected behavior works correctly in LESS v1.3.1 and below.

I updated to v2.6 of Web Essentials via the Visual Studio extensions update dialog. Then I replaced the contents of the LESS script file in the path X:\Users\{USER}\AppData\Local\Microsoft\VisualStudio\11.0\Extensions\{HASH}\Resources\Scripts\less-1.3.0.js (which was v1.3.3 originally with the Web Essentials v2.6 update) with the scripts for versions 1.3.0, 1.3.1, 1.3.2, 1.4.0-beta, 1.4.0 and 1.4.1. The compiles only worked with versions 1.3.1 and lower.

I'm wondering if something got broken when support for @import-once was removed.

UPDATE 2: Version 2.7 of Web Essentials still exhibits this behavior, but can be fixed also as per above.

like image 533
Neil Monroe Avatar asked Mar 28 '13 20:03

Neil Monroe


1 Answers

2.6 has the 1.3.3 version of the official LESS compiler. It might have a bug. I'll investigate this issue and release an update when I have a fix.

Thanks for reporting this!

UPDATE: FIXED!

This has now been verified and fixed for VS 2012 as of July 16, 2013.

Version 2.8 of Web Essentials addresses the issue in this question, so if you update again from within Visual Studio 2012 or by manually installing the extension you will be able to use the LESS compiler for relative @import statements.

It will only work with LESS 1.3.3 (the version packaged with the extension), but this shouldn't be an issue since it now works out-of-the-box.

To see what else was updated in v2.8 of the extension, check the change log: http://vswebessentials.com/changelog

Thanks to Mads Kristensen and the rest of the team that helped to fix this!

UPDATE: VS AUTO-UPDATE

v2.8.1 of the extension for VS 2013 pushed out to the Visual Studio Extension Gallery. You should get the VS auto-update message or go to "Tools > Extensions and Updates..." menu item and update from there.

like image 137
Mads Kvist Kristensen Avatar answered Oct 13 '22 19:10

Mads Kvist Kristensen