-
Notifications
You must be signed in to change notification settings - Fork 3.4k
difference between a imported namespace and a declared one #1895
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
Comments
The problem is we process mixin calls before we process rulesets - so that mixins can bring variables into scope. To fix this we need to pull out the import process to a seperate visitor before the eval call. I think this would be a good idea. work-around would be to wrap everything in
|
Thank for your quick response. I agrees it seems a good idea to fix this. NB i don't understand how if have to wrap my namespace mixin in:
|
Sorry.. what do you mean? |
I've been looking for something like this. I would like to namespace external third party code while also "referencing" them. This makes CSS closer to modular architecture similar to CommonJS. Something like this:
This makes all the CSS code inside bootstrap-theme contained inside the #Namespace, while still abiding by the (reference) keyword. A question, can variables be "namespaced"? They seem like they can't.
|
@lukeapage i try to find a fix for:
@CMCDragonkai see #1848 for namespaced vars. to wrap a third party less file use update (for @CMCDragonkai) |
I.e. the problem there is not that
|
@bassjobsen What do you mean? Neither this syntax
Nor what I suggested
Currently works? I get a syntax error. |
@CMCDragonkai |
@seven-phases-max, thanks that (the & for my mixin) works well |
I used your snippet. And it works some what. There's an issue. So this does not work (I get the undefined error):
However this does work:
It seems that this importing external files into namespaces only works when the original code is considered to be a "less" file. However the file that I'm importing is just a CSS file. Furthermore I want to "(reference)" it. So is there a way to make less recognise that I want to reference it and process it as a less file? |
@CMCDragonkai I've updated my answer with correct imports. Later on please use the SO for a general "usage/how-to" like stuff. It's quite difficult to track the issues in time when discussion there quickly spreads too wide. |
@seven-phases-max Sorry for derailing the discussion. But @bassjobsen brought up an issue while doing it your way:
I used your updated snippet. And yes it does work now, but "reference" does not actually reference properly, the entire CSS code in Bootstrap is imported into the output. This indeed can be a separate question. |
@CMCDragonkai OK, then I guess that's a good case for another ticket, i.e. |
this code work well:
Then i create a file ns.less which contains:
now the code below shows an error:
error: "SyntaxError: #ns > .nsmixin is undefined" this only happens when its wrapped inside a mixin. Use the namespace in a class works well too:
The text was updated successfully, but these errors were encountered: