On Github una / 20140106-file-structure
That being said, Let's not do this.
A partial is simply a Sass file named with a leading underscore
|-- _wow.scss |-- _such.scss |-- _partials.scssIn order to understand any of these methods, we need to take a look at partials. Plain and simple, a partial is simply a Sass file named with a leading underscore. The underscore lets Sass know that the file is only a partial file and that it should be generated (imported) into a CSS file with the @import directive.
partials/ |-- _alerts.scss |-- _buttons.scss |-- _checkboxes.scss |-- _choices.scss |-- _countdowns.scss |-- _footer.scss |-- _forms.scss |-- _icons.scss |-- _menus.scss |-- _messages.scss |-- _modifiers.scss |-- _panes.scss |-- _ratings.scss |-- _results.scss |-- _selectboxes.scss |-- _tableviews.scss |-- _textboxes.scss |-- _throbbers.scss `-- _typography.scssSo these are a bunch of uses for partials. I don't know where I pulled that from or what throbbers.scss is... so don't judge me
/framework /modules /vendor /section _bootstrap.scss section.scssThis is the overall structure which Mathew Suggests. - In Frameworks, you'd have variables, mixins for breakpoints, and project-wide CSS -- keeping it as agnostic as possible. - Modules contains buttons, icons, forms, and whatever else you can easily extend in your project. - Vendor is reserved for 3rd party code, such as jquery UI AND should always end with an overrides.scss file where you specifically changes the vendor CSS. - The Section folder corresponds to specific items, such as an admin panel or login, which haven't been modularized yet. Section.scss would be where you import related files. We'll get to that in a second.
@import ‘compass’; @import ‘compass/reset’; @import ‘framework/all’; @import ‘vendor/jquery.ui.core’; @import ‘vendor/overrides’; @import ‘modules/buttons’; @import ‘modules/icons’;Everything seems pretty simple and self explanatory while reading the other files, but I had no idea what he meant by bootstrap.scss. Well basically, its just a section with very little code, that becomes a way to include your global files into any other section.
// admin.scss @import ‘bootstrap’; @import ‘modules/forms’; @import ‘admin/accounts’; @import ‘admin/dashboards’;Each section file (this is an example of the admin area) contains: - Bootstrap itself - Import any additional modules/vendor used in that section - Import all partials from the matching section folder So you would end up having as many sections as you need at the root of your sass folder, and then importing THOSE into a main.scss file which you can watch and that will be what converts to CSS.
Explain MVC Structure here and how it relates to Sass
Overview
And what files go under a module, for instance
|- sass/ |--- buttons/ |--- color/ |--- forms/ |--- layouts/ |--- modules/ |--- typography/ |--- ui_patterns/ |--- _buttons.scss |--- _config.scss |--- _forms.scss |--- _global_design.scss |--- _reset.scss |--- _typography.scss |--- style.scss
|- sass/ |--- modules/ |----- registration/ |------- _extends.scss |------- _functions.scss |------- _mixin.scss |------- _module_registration.scss |------- _module_personalInfo.scss |----- purchase/ |------- _extends.scss |------- _functions.scss |------- _mixin.scss |------- _module_summary.scss |------- _module_purchase.scss
stuff
stylesheets/ | |-- modules/ # Common modules | |-- _all.scss # Include to get all modules | |-- _utility.scss # Module name | |-- _colors.scss # Etc... | ... | |-- partials/ # Partials | |-- _base.sass # imports for all mixins + global project variables | |-- _buttons.scss # buttons | |-- _figures.scss # figures | |-- _grids.scss # grids | |-- _typography.scss # typography | |-- _reset.scss # reset | ... | |-- vendor/ # CSS or Sass from other projects | |-- _colorpicker.scss | |-- _jquery.ui.core.scss | ... | `-- main.scss # primary Sass file
stylesheets/ | |-- admin/ # Admin sub-project | |-- modules/ | |-- partials/ | `-- _base.scss | |-- account/ # Account sub-project | |-- modules/ | |-- partials/ | `-- _base.scss | |-- site/ # Site sub-project | |-- modules/ | |-- partials/ | `-- _base.scss | |-- vendor/ # CSS or Sass from other projects | |-- _colorpicker-1.1.scss | |-- _jquery.ui.core-1.9.1.scss | ... | |-- admin.scss # Primary stylesheets for each project |-- account.scss `-- site.scss
2 - Clean Out Your Sass Junk Drawer 2 - SASS Development w/SMACSS and BEM 3 - Modular CSS Naming Conventions