Skip to content

Problems with "bootstrap.less" namespacing. #2535

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

Closed
GregLancaster71 opened this issue Apr 3, 2015 · 8 comments
Closed

Problems with "bootstrap.less" namespacing. #2535

GregLancaster71 opened this issue Apr 3, 2015 · 8 comments

Comments

@GregLancaster71
Copy link

I have spent the last several hours reading, and googling how to accomplish this. My only goal is to @import four files containing mixins. However, they are borrowed and repurposed from bootstraps grid system so I need them namespaced. Why is this damn near impossible to do?

Can someone help me out here? Even a decent, in depth tutorial link on scoping would be great. I mean seriously, several hours just trying to import some damn mixins and variables? I see bootstrap imports mixins without any issue - but they dont use any name spacing.

@matthew-dean
Copy link
Member

You mean as in:

#mynamespace {
  .mixin() {
    foo: bar;
  }
}
.demo {
  #mynamespace.mixin();
}

Like that?

@GregLancaster71
Copy link
Author

I tried something almost exactly like that but without the foo: bar: what
would that be representing? A variable? I need to import these four
files, and then call the mixins.

I should be more clear. I have four files I import into one file. That one file is then imported into my primary less file. From that I am attempting to access these mixins.

Thanks for the reply too, feel like I'm losing my head here.

On Friday, April 3, 2015, Matthew Dean [email protected] wrote:

You mean as in:

#mynamespace {
.mixin() {
foo: bar;
}
}.demo {
#mynamespace.mixin();
}

Like that?


Reply to this email directly or view it on GitHub
#2535 (comment).

@matthew-dean
Copy link
Member

foo: bar is representing a property and value, as in color: green.

@GregLancaster71
Copy link
Author

I am trying to namespace using imports. Like:

#mynamespace {
    @import: 'grid.less';
    @import: 'grid-framework.less';
    @import: 'mixins.less';
    @import: 'variables.less';
}
.demo {
  #mynamespace.make-row();
}

Is that something that is possible?

@seven-phases-max
Copy link
Member

Your mistake is in : after import - these statements define variables named import not really importing files (doh! I guess we should put warning there even if it's absolutely valid Less statement (I saw this @import: typo problem twice today :)).

@seven-phases-max
Copy link
Member

Either way when you fix this : error you still will face certain problems (assuming these files are from Bootstrap) since Bootstrap uses certain code snippets not compatible with such kind of namespacing (in other words, it is not supposed to be used like this and they officially do not support such usage), for more details on particular problems see:

Though just #mynamespace.make-row(); will work fine.
(But the files you need to import may differ depending on the Bootstrap version: for example with v3.2.0 I've just tried you also need utilities.less for the .clearfix class.)

@GregLancaster71
Copy link
Author

That was actually a typo. The code you provided did work, but only for one mixin. The second returned this upon compiling:
No matching definition was found for.

I thought I could namespace it for use like #mynamespace.make-row();. I feel like I'm taking crazy pills! Maybe i have been looking at the screen to long. Literally, all I am trying to do is import the bootstrap /mixins/grid.less file and keep it namespaced. :-/ Thank you for your help seven-phases-max, I dont think theres a solution immediately available.

@seven-phases-max
Copy link
Member

Closing this as not an issue (and if it would it's a duplicate of #2052).

  • For "how-to"/"help-me-with" kind of questions the better place to ask is SO.

@seven-phases-max seven-phases-max changed the title Am I crazy, or is it literally impossible to namespace an imported less file? Problems with "bootstrap.less" namespacing. Apr 4, 2015
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

3 participants