-
-
ChrisC
-
1 post
|
Thanks for making this available, it's made working with .less in VS2010 considerably nicer.
Here's a few issues I've come across that you may like to take into account:
- When an imported .less file is loaded via a relative path (e.g. "../App_Data/something.less"), and that file itself contains import statements that refer to files within the same directory (without any path), anything declared in those referenced files won't be resolved.
It appears as if your parser doesn't locate the file, probably because it's looking for the file in the same directory as the original file, rather than the one from which they were directly included. While there doesn't seem to be any standard for whether this should work or not, I will comment that at least with dotLESS, the included files are found and the file compiles correctly. Web Workbench will parse them OK if I use the relative path in both files.
- The parser seems to dislike the %() string formatting function when parameters are supplied; e.g.
@temp: %("color-border-%s", @element);
Is flagged as a syntax error. Additionally, it also doesn't seem to handle indirect references to variables, such as that allowed by the @@ operator, as in this example:
@temp1: 1px;
@temp2: "temp1";
.foo {
border: @@temp2;
}
Unfortuantely we use both a fair bit in our mixins, such as in the following example:
.Colors(@element: default) {
@temp1: %("color-background-%s", @element);
@temp2: %("color-text-%s", @element);
color: @@temp2;
background-color: @@temp1;
}
which allows us to for example use '.Colors(header) ' witin a class, and providing we've previously defined '@color-background-header ' and '@color-text-header ', the appropriate values get emitted (and if not supplied, '@color-background-default ' and '@color-text-default ' are used).
The include path thing doesn't bother me too much as it's easily worked around (though I suspect it would also be easy to fix, if it is in fact a bug). The tagging of the above code as errors is more problematic, since any references to any of those mixins throughout all of our .less source is being squiggled.
You can also observe the '%()' issue if you look at the popular 'bootstrap.less' mixin file from Mark Otto.
|