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 https://github.com/twbs/bootstrap/issues/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
With the forms redux, I already want to move all that into a new subfolder. What other changes would you be interested in making?
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).
@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
Splitting the variables.scss
file is something we could look in to, imo that something we can do after cleaning up the folder structure.
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.
That will be awesome if V5 adopts ITCSS architecture.
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 :)
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.
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.
Most helpful comment
I guess a folder structure like this would be the result in the end:
In each folder some files could be grouped into folders if needed (like the form stuff).