Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpolated import does not work with url expressions #1869

Closed
SomMeri opened this issue Feb 13, 2014 · 6 comments
Closed

Interpolated import does not work with url expressions #1869

SomMeri opened this issue Feb 13, 2014 · 6 comments

Comments

@SomMeri
Copy link
Member

SomMeri commented Feb 13, 2014

Following less fragment:

... blah ...
@import url(@{directory}flagged-varmix-fifth.less);
... blah ...

returns this error:

c:\data\meri\less4java\commandLineLess\node.js-1.6.0>lessc test.less FileError: '@{directory}flagged-varmix-fifth.less' wasn't found in c:\data\meri\less4java\commandLineLess\node.js-1.6.0\test.less on line 13, column 1:
12 @import "@{directory}flagged-varmix-fourth.less";
13 @import url(@{directory}flagged-varmix-fifth.less);
14 .mixinFactory(sixth);

workaround:

... blah ...
@import "@{directory}flagged-varmix-fifth.less";
... blah ...
@lukeapage
Copy link
Member

as designed - we don't interpolate in unquoted url functions. I'm sure this case up a couple of days ago but I cannot find it.
Unquoted urls are a source of hell because they operate their own grammar outside of everything else

url(// comment \) or not? oh look I can escape quotes and brackets outside of quotes\");

I'm not even sure if we even support the above.

@seven-phases-max
Copy link
Member

I'm sure this case up a couple of days ago but I cannot find it.

I guess that was this one: #1863

@lukeapage
Copy link
Member

Ah yes it was the 2nd part of that yes.

@SomMeri do you think this should work or was this just a question? If its a question we can just close ;)

@SomMeri
Copy link
Member Author

SomMeri commented Feb 13, 2014

@SomMeri We can consider it just a question. I expected it to work, so I opened issue.I do not expect it to work anymore, so all is good :).

@SomMeri SomMeri closed this as completed Feb 13, 2014
@matthew-dean
Copy link
Member

Is there a reason we cannot consider url(" synonymous with url(? The regex can't treat the starting (and ending) quote as optional and everything between url( and ) a string?

@lukeapage
Copy link
Member

@matthew-dean the escaping rules are different - not just for parsing but for output too. In addition the logic for replacing variables is in quoted (which is why variable interpolation outside of strings doesn't work apart from where custom code is written - selectors, properties).
It could work like this, but unquoted urls are a pain in the arse and it would make the code more complicated and things more tricky, for very little benefit (IMO... Because of the escaping rules I would say that quoting url's is good practice, certainly within Less).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants