SMACSS has categorization rules for CSS that start with the "base" rules that contain styling for base HTML elements. http://smacss.com/book/type-base
Compass' best practices ( http://compass-style.org/help/tutorials/best_practices/ ), a relatively obscure documentation page actually, recommends using a _base.scss partial to define your variables and import your Compass extensions.
Its extremely confusing in the existing styles.scss to do:
@import "base"; /* compass base, not SMACSS base */
@import "normalize"; /* SMACSS Base rules */
Given that the Compass recommended practice is much less widely known then the SMACSS category, I think we should rename the _base.scss partial.
But what to?
_config.scss, _configuration.scss, _settings.scss, _setup.scss? Any other better suggestions?
Comment | File | Size | Author |
---|---|---|---|
#11 | base-scss-smacss-1839484-10.patch | 13.68 KB | mobweb |
#10 | base-scss-smacss-1839484-10.patch | 12.65 KB | mobweb |
Comments
Comment #1
JohnAlbinI posed this question to the Compass users' group: https://groups.google.com/forum/?fromgroups=#!topic/compass-users/TRlhkUZ1Q3E
I'm now leaning towards _init.scss.
But let's see what response we get from that list. :-)
Comment #2
dropfen CreditAttribution: dropfen commentedWhy not change the SMACSS category "_base" to "_global" ?
Comment #3
Lukas von BlarerThis is what just confused me... The _normalize.scss is a reset stylesheet, not for base styles.
A sample file structure form the SMACSS book:
We should have something like this:
_settings.scss
_mixins.scss
_normalize.scss
_base.scss
_layout.scss
_modules.scss
_states.scss
_print.scss
styles.scss
What do you think?
Should we introduce folders? Maybe a folder for layouts, modules and themes? I remember that once there was one for layouts... Why was it removed?
Comment #4
caschbre CreditAttribution: caschbre commentedI think using folders would be great. I've had a few projects where I wanted to break up the scss files into smaller includes.
Comment #5
Lukas von BlarerWhat do you think of the my file setup? Specifically these ones:
_settings.scss
_mixins.scss
_normalize.scss
_base.scss
Comment #6
caschbre CreditAttribution: caschbre commentedLooks like _mixins and _settings are the only new files? What would typically go into the settings file?
Comment #7
Lukas von BlarerI would split up the current _base.scss file into these two. _settings.scss containing all global settings and _mixins.scss all custom mixins.
As a replacement we could then use _base.scss as the base as it is referenced in SMACSS. To define global styles.
Comment #8
caschbre CreditAttribution: caschbre commentedAh, that makes sense. I like it.
Comment #9
Lukas von BlarerGreat. I just started creating a Zen subtheme using this approach and it feels good :)
@JohnAlbin do you agree?
Comment #10
mobweb CreditAttribution: mobweb commentedPatch according to the changes proposed in #7.
Comment #11
mobweb CreditAttribution: mobweb commentedIgnore the previous patch, forgot to include the changes made to styles.scss, sorry.
Comment #12
JohnAlbinI've renamed _base.scss to _init.scss.
And I've re-added the layouts folder. And included a new components folder. This is a directory structure I've been playing with and mirrors what I've seen others do.
http://drupalcode.org/project/zen.git/commitdiff/504b743
Comment #13
Lukas von BlarerOk... It would be nice to have a file structure that is intuitive and works for different sizes of projects. And therefore have one structure across all zen subthemes.
The _base.scss is missing now.
Why did you remove the _global_states.scss? (I don't use it though.)
Why did you use the term components? Why not use the same terminology as in SMACSS?
Comment #14
JohnAlbinAs I said in comment #1, I've renamed it to _init.scss.
It wasn't useful. State changes of components should be placed next to the component. Putting the state styling in a separate file was a mistake on my part when I first implemented SMACSS organization in Zen.
We're using components in Drupal 8 because SMACSS uses "modules", which… is mega-confusing for Drupal users.
Comment #15
echoz CreditAttribution: echoz commentedComment #16
Lukas von BlarerBut the _base.scss is supposed to be the place to define global styles. This is why we renamed it to _init.scss initially, right?
Agreed.
Ok. Makes sense as well.
Comment #17
Lukas von BlarerBTW... I really like to have a separate file for settings and one for mixins. I don't see the reason for them to be in the same file.
Comment #18
dropfen CreditAttribution: dropfen commented1+ It makes sense to separate this files.
configs are not mixins. Configs are something you want modify once, by creating your project.
Comment #19
JohnAlbinNo, we renamed it because it doesn't contain our base styles. The normalize.scss file contains the base styles.
Yeah, I'm not too crazy about them being in the same file too. Let's move that discussion to #2038527: Move custom mixins out of _init.scss
Comment #20
Lukas von BlarerOk. I thought that _normalize.scss was supposed to be untouched and all resets should be made in a separate file instead (this is what i prefer since mixing CSS code of a reset stylesheet and very project specific global styles might be confusing). But in that case everything is clear now.