As per #1921610: [Meta] Architect our CSS, Zurb Foundation should utilize smacss structure as closely as possible:
+ css
+ base
- normalize.css
- elements.css
+ layout
- layout.css
- layout--medium.css
- layout--wide.css
+ components
- button.css
- dropdown.css
- pagination.css
- tabs.css
…
+ theme / skin
- theme--light.css
- theme--dark.css
From: http://drupal.org/node/1887922
Since zurb foundation utilizes this on it's own file structure, still have to figure out how this will work out for a theme.
Remaining tasks
@todo
#1990626: Update info file for inclusion of BAT css file structure
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 1991114-12--by-chrisjlee-Create-smacss-structure-f.patch | 867.06 KB | chrisjlee |
Comments
Comment #0.0
chrisjlee commentedupdate reference
Comment #0.1
chrisjlee commentedadd file structure example
Comment #0.2
chrisjlee commentedUpdated issue summary.
Comment #1
chrisjlee commentedConsulted this idea with Ishmael and he agrees with the motion. I've updated the summary with followup issues.
Comment #1.0
chrisjlee commentedupdate message
Comment #2
maggo commentedWould you rather build that structure using scss and @import's, or with single (compiled) css files, bundled and minified by drupal itself?
Comment #3
alexweber commented@maggo, I'm not exactly sure what Chris and Ishmael have talked about but personally I think that it's a mixture of both approaches; normalize should be a separate (s)css file, foundation should be a single scss, manually including the desired components and compile to a single css file and drupal-specific theme overrides (like compatibility with admin menu from that other issue) should be a separate (s)css file.
That would leave us with 3 separate css includes in our .info file: normalize, foundation and base theme stuff.
Sub-themes would follow in that logic and presumably the option to disable base theme css would be expanded to discriminate between these files so, for example, a sub-theme could include its own normalize/reset, its own custom foundation but maybe still use the drupal overrides from the base theme.
Ideas?
Comment #4
chrisjlee commentedWith sass everything should be packaged as one file app.scss.
Comment #5
micheas commented@chris
I don't follow.
While you will compile to one app.css file app.scss can include _drupal.scss _forms.scss _openlayers.scss _panels.scss _colors.sass _views.scss and whatever other underscore files you want to include.
I find that underscore files help people maintain organization as we know where to look for specific css with out having to open a large file and hope that the comments are correct. (much more likely with scss than css but still a bit of an issue.)
Comment #6
maggo commented+1 for #3
Comment #7
alexweber commentedChris, another argument against having everything in one big app.css file is caching... There's AdvAgg and Core Library and possibly other modules too that provide some sort of advanced smart aggregation/bundling for CSS/JS stuff and I think that, specially if using Foundation as a base theme for the admin theme too, there's situations when you would want to separate normalize, modernizr and foundation from theme-specific stuff, think of it like jQuery, jQuery.once and Drupal.js... since it's guaranteed that they'll be on every page, they can be grouped into one bundle, however other theme resouces might only apply to certain situations so if we decouple them, we make it easier for contrib/users to manage this stuff in a more efficient manner.
Apologies if this doesn't make sense, it's early and I'm really jet-lagged :)
Comment #8
chrisjlee commentedYeah let me clarify before you bring out the pitchforks. :).
If you look at the zen theme. I'm just stealing their approach. The app.scss file will be just a boot file that contains a bunch of partials as described by Micheas in #5.
See the styles.scss file in zen as an example of where i'd like to go:
Besides with a sass approach one compiled file this removes the dependancy for you to even need to aggregate your files. This gives you the flexibility to go without using another module. Compiling it will ensure your sass files are loaded correctly as well.
Does this all make sense?
Comment #9
alexweber commented@Chris, yeah it makes perfect sense! :)
At the end of they day I think that not only are both approaches good and valid, but they're also relatively straightforwards to override in sub-themes in case anyone really needs one or another approach too.
So, to summarise: let's go with the solution you described!
We can haz patch? (or direct commit!)
Comment #10
ishmael-sanchez commented+1 for #8
Comment #11
chrisjlee commentedI'll get you a patch here. Hopefully this weekend.
Comment #12
chrisjlee commentedMega patch. If there are no large overall issues i'll commit this in the next few days.
Comment #13
alexweber commentedNice patch Chris!
I found some minor things:
And again, awesome patch dude, I love it and it'll close a couple other issues too!
Comment #14
alexweber commentedChris, please take a look at this comment too: https://drupal.org/node/2025469#comment-7769627
Comment #15
chrisjlee commented@alex. Valid feedback and good catches. I'll update for you here later this week. I'm nearing a deadline.
Comment #16
alexweber commented@Chris,
Do you just wanna commit this now and I can follow-up with the catches?
I have some time this week so it's as good a time as any! :)
Comment #17
chrisjlee commentedNot sure why the git commits haven't updated on commit page but committed:
13998da
Comment #18
chrisjlee commentedah here it is. I cherry picked it so the timestamp will be in the past: http://drupalcode.org/project/zurb-foundation.git/commit/13998da
Comment #19
alexweber commentedAwesome Chris!
I'm making the changes I mentioned in #13
Comment #20
alexweber commentedhttp://drupalcode.org/project/zurb-foundation.git/commit/26bb6db
http://drupalcode.org/project/zurb-foundation.git/commit/feac1d2
http://drupalcode.org/project/zurb-foundation.git/commit/3dfed35
Comment #21.0
(not verified) commentedUpdated issue summary.