Pat Long - Munkii Yebee
Pat Long - Munkii Yebee

Reputation: 3629

Web Essentials 2012 .LESS Import (reference)

I have some .Less files that contain just variables. I want to reference those variables in other Less files. .Less offers a (reference) style import (http://lesscss.org/features/#import-options)

Example: @import (reference) "foo.less";

This looks to be exactly what i want for my variable files, however when i try it in in VS2012 with WebEssentials I get these errors trying to import my "vars.less" file

Missing a URL after "@import"
Expected a media query or semi-colon

@import (reference) "_vars";
  1. Does the WebEssentials .Less integration not support this?
  2. Should I not be importing .Less like this?

Thanks

Upvotes: 1

Views: 908

Answers (2)

Colin Bacon
Colin Bacon

Reputation: 15609

I don't think this is the correct usage of reference.

From http://lesscss.org/features/#import-options

Use @import (reference) to import external files, but without adding the imported styles to the compiled output unless referenced.

If your variable file only contains variables then you can just import them as they do not output css and the same with mixin files.

The idea behind reference is to be able to import a separate less file with styles in it and only compile the styles used to css.

Upvotes: 1

Mario Levrero
Mario Levrero

Reputation: 3367

I'm running in the same issue wit WebEssentials2013. Despite the error, the compilation builds properly.

From https://github.com/madskristensen/WebEssentials2013/issues/218

The warnings are because VS's LESS parser doesn't recognize the new syntax. Ignore them.

Upvotes: 1

Related Questions