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

@import @variable_containing_file_url #707

Closed
sformisano opened this issue Mar 13, 2012 · 3 comments
Closed

@import @variable_containing_file_url #707

sformisano opened this issue Mar 13, 2012 · 3 comments

Comments

@sformisano
Copy link

Hello

I am sharing the same less mixins rules across many css files with a css @import. This is part of a script so I can't simply give the import a fixed, full url to the elements.less file. Unfortunately I was not able to hold a full url in a variable and use it with the @import as follows:

@import @blueprint_mixins_url;

I don't get any parsing error: I'm simply informed that the mixins I use later in the css are not defined (which obviously means the import failed)

Here are my steps if anyone is curious:

  1. The html tag in the page holds the path to the blueprint I use (a data attribute getting its value from php):
@blueprint_directory : `document.getElementsByTagName('html')[0].getAttribute("data-blueprint-url")`;
  1. A second variable uses string interpolation and adds the standard subpath to elements.less
@blueprint_mixins_url : "@{blueprint_directory}/css/blueprint/elements.css";

I know that the full path is correct because by trying:

html{
 demo: @blueprint_mixins_url;
}

I do get the correct path to the file in this demo property. The following, however, does not work

@import @blueprint_mixins_url;

Does the current implementation allow this? If not is there a workaround or a better way to achieve a similar result?

Thanks

@Kalyse
Copy link

Kalyse commented Mar 13, 2012

I tried last week to achieve this, and couldn't. The value contained with the import doesn't get interpretted, and no matter what I was doing it would always just use the @variable as a literal string, even when you tried to coerce less to run it as JS.

@bdalziel
Copy link

I think this is a duplicate of Issue 410: #410

I'm trying to do the same thing.

@lukeapage
Copy link
Member

duplicate of #410

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

No branches or pull requests

4 participants