Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Essentials v2.8 LESS import error

For better organization, I have a main .less file that imports other .less files using the @import syntax. In order for the Web Essentials Preview window to work I also have @import-once at the top of each .less file that imports the variables.less file.

This solution worked wonderfully until I upgraded to Web Essentials 2.8. Now I'm unable to import any .less file that has @import or @import-once declared in it. My main .less file no longer compiles.

If I remove the @import-once statements, the preview window is useless since I can't see the compiled CSS without importing my variables file.

I also had a case where I imported a .less file into a ruleset, as defined by lesscss.org in the Importing into ruleset section. This also no longer works since the upgrade to v2.8.

Has anyone else experienced these issues or have a resolution?

Thanks

like image 514
Evan Portwood Avatar asked Jul 17 '13 14:07

Evan Portwood


2 Answers

This seems to be a bug -> Feature in the latest version of the WebEssentials because of a new feature in Less 1.4.0. as Anwar describes. See the changelog of Less:

1.4.0 Beta 1 & 2 (2013-03-07)

  • default behaviour of import is to import each file once. @import-once has been removed.

Either

Update your files to use the new syntax (remove the -once from your imports)

Or

To use the older version of the engine, download the previous (2.7) version and don't update until you know it has been fixed.

Or

Or you can configure your Visual Studio to look at the Nightly Build feed from Web Essentials to download the very latest version (caution, nightly builds may contain other bugs or stop working from time to time). TO do so go to Tools -> Options -> Extensions & Updates and add the feed: http://vswebessentials.com/nightly/feed.ashx

Which seems to add a workaround that makes it work with the old syntax as well. Add WebEssentials Nightly feed

like image 85
jessehouwing Avatar answered Oct 17 '22 17:10

jessehouwing


In Less v1.4.0 @import-once has been removed and @import imports once by default. This means that with the following

@import “file.less”; @import “file.less”;

The second file is ignored.

I think that one is causing issue with import statements.

like image 28
Anwar Javed Avatar answered Oct 17 '22 18:10

Anwar Javed