Skip to content
New issue

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

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

Already on GitHub? # to your account

Reorganize Scss folder structure #28553

Open
MartijnCuppens opened this issue Mar 24, 2019 · 11 comments · May be fixed by #41236
Open

Reorganize Scss folder structure #28553

MartijnCuppens opened this issue Mar 24, 2019 · 11 comments · May be fixed by #41236

Comments

@MartijnCuppens
Copy link
Member

Our current scss file and folder architecture is a bit unclear. We have a _variables.scss file on the same level as the components. There's also a _mixins.scss file which includes the mixins in another folder. There might be some room for reorganisation.

We could come up with our own folder structure but it might be interesting to have a look at existing solutions. Maybe ITCSS could help us out.

ITCSS has been discussed already in #18233 but this was also about splitting our variables file, I wouldn't do that for now. Just reorganising the files into folders would be a great start.

Feel free to spread your thoughts on this here

/CC @twbs/css-review

@mdo
Copy link
Member

mdo commented Apr 3, 2019

With the forms redux, I already want to move all that into a new subfolder. What other changes would you be interested in making?

@MartijnCuppens
Copy link
Member Author

I guess a folder structure like this would be the result in the end:

bootstrap/
└── scss/
    ├── settings/
    │   └── variables.scss
    ├── tools/
    │   ├── functions.scss
    │   └── mixins
    │       └── ... All mixin files here
    ├── generic/
    │   ├── reboot.scss
    │   └── root.scss
    ├── elements/
    │   └── type.scss
    ├── objects/
    │   ├── images.scss
    │   ├── code.scss
    │   ├── grid.scss
    │   └── transitions.scss
    ├── components/
    │   ├── tables.scss
    │   ├── forms.scss
    │   ├── buttons.scss
    │   ├── dropdown.scss
    │   ├── button-group.scss
    │   ├── input-group.scss
    │   ├── custom-forms.scss
    │   ├── nav.scss
    │   ├── navbar.scss
    │   ├── card.scss
    │   ├── breadcrumb.scss
    │   ├── pagination.scss
    │   ├── badge.scss
    │   ├── alert.scss
    │   ├── progress.scss
    │   ├── list-group.scss
    │   ├── close.scss
    │   ├── toasts.scss
    │   ├── modal.scss
    │   ├── tooltip.scss
    │   ├── popover.scss
    │   ├── carousel.scss
    │   └── spinners.scss
    ├── utilities/
    │   └── utilities.scss
    ├── bootstrap.scss
    ├── bootstrap-grid.scss
    └── bootstrap-reboot.scss

In each folder some files could be grouped into folders if needed (like the form stuff).

@GeoSot
Copy link
Member

GeoSot commented Apr 11, 2019

@mdo @MartijnCuppens

May I propose and a split on the variables.scss?

It has being too big... Or Maybe One main File with the main variables and a second which will have all the inherited variables

@MartijnCuppens
Copy link
Member Author

Splitting the variables.scss file is something we could look in to, imo that something we can do after cleaning up the folder structure.

@tomhrtly
Copy link

tomhrtly commented May 3, 2019

I agree with @GeoSot, it would be handy to have two separate variable files, one for the initial variables and another for derived ones. It would save having to redeclare some variables such as colors as this is usually the file that is imported first in the SCSS setup.

@inwardmovement
Copy link
Contributor

That will be awesome if V5 adopts ITCSS architecture.

@ffoodd
Copy link
Member

ffoodd commented Apr 22, 2020

FWIW I got used to @hugogiraudel's 7-1 pattern which would be very consistent with our current namings:

  • base/
  • components/
  • layout/
  • pages/
  • themes/
  • abstracts/
  • vendors/

Except for pages and themes (that could be used in our docs, eg. for the Examples section) I think that could be a good candidate :)

@k-utsumi
Copy link
Contributor

7-1 pattern

I think Magical Number helps Information Architecture.
https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two

I like setting it to 3-4, but I don't think it must set maximum to 7.

@ffoodd
Copy link
Member

ffoodd commented Apr 24, 2020

In fact it does, since it's not magical but describes the number of folders. You may think of .col-2 as a reference.

And at least, this pattern has a name, is documented and pretty common.

@mdo mdo added v6 and removed v5 labels Jan 10, 2021
@mdo
Copy link
Member

mdo commented Jan 10, 2021

Punting to v6 for future discussion.

@willfaught
Copy link

Note that if the scss directory is put into a Hugo module/theme repo, "vendor" directories are omitted from that module when imported, which breaks the module. Currently, every time I update the copy of Bootstrap in my Hugo module, I have to manually patch it to rename the vendor directory to _vendor. It would be great if "vendor" directory names are avoided in the future. :)

@mdo mdo linked a pull request Feb 21, 2025 that will close this issue
56 tasks
@mdo mdo added the has-pr label Feb 21, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants