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

Including "bootstrap-grid.scss" only leads to somewhat broken grid #17982

Closed
Restuta opened this issue Oct 19, 2015 · 3 comments
Closed

Including "bootstrap-grid.scss" only leads to somewhat broken grid #17982

Restuta opened this issue Oct 19, 2015 · 3 comments

Comments

@Restuta
Copy link

Restuta commented Oct 19, 2015

I am not sure if this is by design or not. But I wanted to use "BS4 grid only" for my app. I assumed that should be possible, since I see "Grid Only" download option in alpha-docs.

So, when I import bootstrap fully like that: @import 'bower_components/bootstrap/scss/bootstrap'; in my project I see the following grid:

When I change it to use grid only @import 'bower_components/bootstrap/scss/bootstrap-grid'; is see this:

This is not browser specific.

I figured out that it's because "reboot.scss" is not included, so I added:

@import 'bower_components/bootstrap/scss/reboot';
@import 'bower_components/bootstrap/scss/bootstrap-grid';

That didn't work, since reboot.scss uses mixins and variables inside without importing them. So I had to manually go and figure it out and the following code fixes that:

@import 'bower_components/bootstrap/scss/mixins/hover';
@import 'bower_components/bootstrap/scss/mixins/tab-focus';
@import 'bower_components/bootstrap/scss/variables';
@import 'bower_components/bootstrap/scss/reboot';
@import 'bower_components/bootstrap/scss/bootstrap-grid';

To sum up, I think it should be obvious default way to use "just a grid" or "just a grid with reboot" (if by design grid should not include "reboot"). That can be solved with explicit imports added to _reboot.scss; So the following code would just work:

@import 'bower_components/bootstrap/scss/reboot';
@import 'bower_components/bootstrap/scss/bootstrap-grid';

If, by design, grid should include "reboot" then also explicit import of "reboot" in a bootstrap-grid.scss.

What do you think? Should I send a PR?

@Restuta Restuta changed the title Including "bootstrap-grid.scss" only leads to somewhat broken grid. v4 - Including "bootstrap-grid.scss" only leads to somewhat broken grid. Oct 19, 2015
@cvrebert cvrebert changed the title v4 - Including "bootstrap-grid.scss" only leads to somewhat broken grid. Including "bootstrap-grid.scss" only leads to somewhat broken grid Oct 19, 2015
@bassjobsen
Copy link
Contributor

i don't think you should import reboot into bootstrap-grid.scss. The build process compiles bootstrap-grid.scss into bootstrap-reboot.scss and bootstrap-reboot.scss. You can use both together in your HTML when you want to use the grid and bootstrap's CSS reset (reboot):

  <link rel="stylesheet" type="text/css" href="bootstrap-4-dev/dist/css/bootstrap-reboot.css">
  <link rel="stylesheet" type="text/css" href="bootstrap-4-dev/dist/css/bootstrap-grid.css">

And yes when you are using both, you should compile it into a single CSS. On the other hand the Bootstrap reset is not required for the grid. The only requirement for using bootstrap-grid.css is setting the global box-sizing value, see http://v4-alpha.getbootstrap.com/getting-started/introduction/#box-sizing

The following code will solve your problem:

  <link rel="stylesheet" type="text/css" href="bootstrap-4-dev/dist/css/bootstrap-grid.css">
  <style>
    html {
      -webkit-box-sizing: border-box;
              box-sizing: border-box;
    }

    *,
    *::before,
    *::after {
      -webkit-box-sizing: inherit;
              box-sizing: inherit;
    }      
  </style>

Notice that importing reboot into bootstrap-grid means you can not import bootstrap-grid anywhere without getting the CSS code generate by reboot at the position of your import. So you can only use it if bootstrap-grid is your first import (output) and you do not CSS any other CSS reset.

@Restuta
Copy link
Author

Restuta commented Nov 1, 2015

@bassjobsen I understand what you said about CSS. When you want to use just CSS it's okay, you would include two files separately like you mentioned, but some people prefer to include bootstrap as SASS and override some stuff. For those people there should be also simple and obvious way to do so.

I outlined a possibility to do that. (referencing needed mixings from inside reboot.scss).

I wasn't insisting in any way that reboot should be included in the grid (I guarded that possibility with "if" though), are you sure you read my post fully?

@mdo mdo mentioned this issue Dec 8, 2015
17 tasks
@Coooi
Copy link

Coooi commented Sep 20, 2016

@bassjobsen THANK YOU!

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

5 participants