Problem
- The Official Drupal 8 CSS architecture documentation states that the SMACSS category name for "skin" is "theme" in Drupal, but the corresponding PHP constant name is
CSS_SKIN.
Goal
- Consistency.
Proposed solution
- Rename the constant from
CSS_SKINtoCSS_THEME. - Adjust + simplify
drupal_get_library()accordingly.
.
.
.
Original summary:
Problem
- #1996238: Replace hook_library_info() by *.libraries.yml file introduced the group "theme" for CSS file assets in
*.libraries.ymldeclarations, which diverges from the SMACSS category "skin".
Goal
- Be consistent with the SMACSS standard.
Details
- The group name "theme" is literally derived from the Official Drupal 8 CSS architecture documentation.
- The name "theme" was chosen instead of "skin", because Drupal already has a concept of "themes", and themes want to be able to override any kind of
.theme.css. - In addition, we introduced a formal split into
foo.base.cssandfoo.theme.cssfor D7 already. - That naming decision is also the reason for why the corresponding CSS files are named
foo.theme.cssinstead offoo.skin.cssin D8.
Proposed solution
- Rename the group from "theme" to "skin" in
*.libraries.ymlfiles. - Rename all corresponding CSS files from
.theme.cssto.skin.css. - Update the CSS architecture documentation page accordingly.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | interdiff.txt | 675 bytes | markhalliwell |
| #12 | die-skin-die-2202671-12.patch | 2.58 KB | markhalliwell |
Comments
Comment #1
tim.plunkettOriginally when #1921610: [Meta] Architect our CSS was happening, and all of the original renames were happening, they were using skin. I, among others, pushed back and we stopped using that completely. I had no idea we forgot to rename the CSS_SKIN constant back to CSS_THEME.
So let's just rename the constant and be done with it.
Comment #2
sunHah, that is certainly a different (opposite) fate and action for this issue. ;)
Happy to re-purpose this issue to just fix the constant name, but let's wait at least a little for themer feedback first. :-)
Comment #3
tim.plunkettIf we do choose to rename the declarations, we need to fix all *.theme.css files to match.
Comment #4
sunYes, that is part of the proposed solution in the issue summary already:
Comment #5
markhalliwellI completely agree with #1. We've already established standards (CSS architecture). Just rename the constant. Skin is so... winamp.
Comment #6
rainbowarrayIf we're going to use SMACSS conventions, it makes a lot more sense to go with theme than skin.
I'm still a bit dubious that themers should essentially be required to have at least a passing familiarity with SMACSS, but if that's what's been decided, then be consistent, rather than have a weird exception to the rest of the SMACSS group names.
Since theme is a word that has a specific meaning within Drupal, I have a feeling theme.css will likely become a dumping ground for all kinds of CSS rules, rather than just rules that fall within the SMACSS concept of theme rules, particularly for themers and site builders unfamiliar with SMACSS.
Comment #7
rainbowarrayThere's a ton of discussion of skin vs theme in #1921610: [Meta] Architect our CSS, and for a lot of sensible reasons, theme was chosen. There's no need to rehash that here. Let's go with theme and move on.
Comment #8
sunAlrighty. Adjusting issue title + summary accordingly. (Leaving the old intact for posterity.)
Comment #9
tim.plunkettComment #10
markhalliwellThis probably needs a re-roll now that #1996238: Replace hook_library_info() by *.libraries.yml file went in.
Comment #11
markhalliwellIgnore me.
Comment #12
markhalliwellNope, I was right. Here's a patch.
Comment #14
joelpittetReviewed the patch, does the deed. Checked no remaining outside of vendor folders.
Unless you want to tackle the 80char line limit on those lines while you're at it? In any case the re resulting patch is still RTBC.
80 chars.
Comment #15
sunYay, thanks all for the quick turnaround :-)
Comment #16
wim leersOne less DX WTF, albeit a pretty internal one :)
Comment #17
alexpottCommitted e93b685 and pushed to 8.x. Thanks!