Note: We are going to try and have this issue as the one and only code cleanup meta issue for Bartik.
Problem/Motivation
- Bartik's template files need to be assessed and cleaned up of redundant markup, bad formatting and ID's.
- Bartik's CSS files need to follow Drupal's CSS Coding Standards.
Proposed resolution
General cleanup
- #1903048: Revise Bartik template indentation inline with best practices.
- #2395825: Remove closing tag comments in template files.
- #2399709: Remove media.css from Bartik, add it's current code directly to the components it references.
- #2398447: Remove the "typography" CSS file in Bartik
- #2396489: Add missing RTL rules to Bartik theme CSS
- #2548805: Add sensible base layout styles for lists in Bartik.
- #2399247: Reduce number of different font-sizes in Bartik for better consistency
Refactor CSS into components (current focus)
Also next we are raising issues based specifically around the CSS files in Bartik that were created in #2375673: Split Bartik's CSS into SMACSS style components. We are aiming to refactor the code for Bartik (templates and CSS) based around components and avoid issues that make changes across a lot of files in Bartik.
Components currently in Bartik listed with their equivalent clean up area issue.
NOVICE TASKS
Components | Issue |
---|---|
css/components/sidebar.css | #2542568: Clean up the "Sidebar" component in Bartik |
css/components/table.css | #2542572: Clean up the "Table" component in Bartik |
css/components/tabs.css | #2542582: Clean up the "Tabs" component in Bartik |
css/components/user.css | #2542598: Clean up the "user" component in Bartik |
css/components/views.css | #2542600: Clean up the "Views" component in Bartik |
css/components/buttons.css | #2542604: Clean up the "buttons" component in Bartik |
css/colors.css | #2542610: Clean up the "colors.css" code in Bartik |
css/print.css | #2542618: Clean up the "print.css" code in Bartik |
The work that will be within the issues in the table above are as follows:
Cleanup tasks
- Check each selector in the CSS file (associated with the particular issue) is in use within core right now.
If not...
a) Check to see if the classes in core have been changed and correct them (for e.g. I found this in this issue ).
or
b) Remove that CSS completely from the CSS file. -
a) Check the CSS selectors are not being replicated in other stylesheets in Bartik.
b) Check the CSS properties are not being overridden by other stylesheets in Bartik.
If a) move all of the properties to the selector in the stylesheet that you think most appropriate for the component you are dealing with.
If a) and b) also remove the CSS properties and values being overridden within that ruleset. - If you find CSS for a component which seems out of place in the file it is currently in move it to the one you think is the correct one.
-
If a selector appears to be too long and/or too specific, check if the selector can be simplified. for eg.
.something .something .something { }
being modified to.something .something { }
. - Check that RTL styles exist when needed and are formatted as per the guidelines. (for e.g. we found that RTL styles are broken on certain pages in this issue, so fix anything you see missing/incorrect in the CSS file.
- If you think the contents of the CSS file could be further broken down into more components CSS files, or grouped together with other existing CSS files to form one component do it. The initial SMACSS issue may not of been perfect, guidelines on CSS file organisation for Drupal 8 can be found here.
- Check the markup from the templates that all of the classes are used as selectors in the CSS files. If not remove them. See an example issue here for this.
Formatting tasks
- Add a File comment to the top of the stylesheet - see here for guidelines.
- Check any other comments are formatted correctly - see here for guidelines.
- Check Whitespace is being used correctly, this includes indentations and line breaks - see here for guidelines.
- Check the formatting of rulesets, properties and media queries are correct - see here for guidelines.
- As mentioned above, check existing RTL styles are formatted correctly - see here for guidelines.
These tasks will be included in the issues for each component and referenced back to this meta.
Comments
Comment #1
jyve CreditAttribution: jyve commentedlooks like colors in lowercase are ok, so that's off the list: #1360790: CSS coding standards: Recommend lowercase not UPPERCASE hex colors
Comment #2
droplet CreditAttribution: droplet commentedlowercase ( code standard just updated )
Comment #3
JohnAlbinDrupal's current "CSS coding standards" are still (after 4 years) still marked as DRAFT. I actually disagree with 2 of the 3 things mentioned in the issue summary. (Which is part of the reason that the standards are still in draft mode.)
Once the CSS coding standards are out of DRAFT, we can revisit.
Comment #4
mgiffordThe CSS coding standards are out of draft mode now, right?
https://www.drupal.org/coding-standards
Comment #5
sqndr CreditAttribution: sqndr commentedComment #6
sqndr CreditAttribution: sqndr commentedRemoving assignment because it was from 3 years ago.
Comment #7
emma.mariaComment #8
emma.mariaComment #9
emma.mariaComment #10
emma.mariaComment #11
emma.mariaComment #12
emma.mariaComment #13
emma.mariaComment #14
emma.mariaComment #15
DickJohnson CreditAttribution: DickJohnson commentedDo we have any kind of "original plan of Bartik" around? I mean the kind of plan where is defined correct font-sizes, colors and stuff like that. Made few checks to current CSS and it f.ex looks like we're using more than 25 different font-sizes in Bartik and that sounds kind of a lot.
Comment #16
LewisNyman@DickJohnson It was designed in the browser so I don't think that there will be able documentation outside of the code. Maybe you can make a separate issue to investigate all the font sizes? Kind of similar to #2298783: Investigate colour consistency in Seven
Comment #17
LewisNymanI made a suggestion regarding the clean up plan in #2347751: Remove id selectors from templates of Bartik. I'm going to update the issue summary here so it's more clear what I mean in practice. One part is tweaking the wording of the sub-issue categories so they are not CSS files specific, but component specific. This is because a lot of CSS files do not completely match up with the standards's definitely of components.
One example is in elements.css:
The feed-icon CSS should be move into it's own CSS file, as it's a defined component. I think this becomes a task of the elements.css issue.
Another example is the
#footer
component which has styling in about 6 different files, so it make sense for this to become it's own issue that affects multiple files that perfects the footer component.Comment #18
DickJohnson CreditAttribution: DickJohnson commentedDid some investigation as @LewisNyman suggested on #16. #2399247: Reduce number of different font-sizes in Bartik for better consistency
In short: We have 37 different values for font-size property.
Comment #19
LewisNymanWe have uncovered a new situation, which is when core module files need to be changed, such as template and CSS, in order to fix Bartik's files. I have suggested a process here: #2398453: Clean up the "admin" component in Bartik
I guess the process would work something like this:
How does that sound?
Comment #20
emma.mariaComment #21
idebr CreditAttribution: idebr commentedComment #22
idebr CreditAttribution: idebr commentedComment #23
idebr CreditAttribution: idebr commentedComment #24
idebr CreditAttribution: idebr commentedComment #25
idebr CreditAttribution: idebr commentedComment #26
idebr CreditAttribution: idebr commentedComment #27
idebr CreditAttribution: idebr commentedComment #28
idebr CreditAttribution: idebr commentedComment #29
idebr CreditAttribution: idebr commentedComment #30
dcrocks CreditAttribution: dcrocks commentedThis should come up here.
Comment #31
LewisNymanBut remember we shouldn't be changing the design in these issues, only restructuring the code.
Comment #32
emma.mariaComment #33
emma.mariaComment #34
emma.mariaComment #35
emma.mariaComment #36
idebr CreditAttribution: idebr commentedAdded #2409069: Clean up the "skip-link" component in Bartik
Comment #37
idebr CreditAttribution: idebr commentedAdded #2408467: Rewrite pager component inline with our CSS standards
Comment #38
idebr CreditAttribution: idebr commentedAdded #2419475: Clean up the "Featured bottom" component in Bartik
Comment #39
idebr CreditAttribution: idebr commentedRemoved css/components/triptych.css as it was removed in #1164784: “Triptych” term is not widely understood; add "Featured top" and "Featured bottom"
Comment #40
idebr CreditAttribution: idebr commentedComment #41
idebr CreditAttribution: idebr commentedAdded #2408511: Rewrite vertical-tabs component inline with our CSS standards
Comment #42
idebr CreditAttribution: idebr commentedIncluded #2456805: Clean up the "messages" component in Bartik
Comment #43
jp.stacey CreditAttribution: jp.stacey commentedComment #44
idebr CreditAttribution: idebr commentedAdded #2398445: Clean up the "elements" component in Bartik
Comment #45
emma.mariaComment #46
emma.mariaComment #47
emma.mariaComment #48
emma.mariaComment #49
emma.mariaComment #50
emma.mariaComment #51
emma.mariaComment #52
emma.mariaComment #53
emma.mariaComment #54
emma.mariaComment #55
emma.mariaComment #56
emma.mariaComment #57
emma.mariaComment #58
emma.mariaComment #59
emma.mariaComment #60
emma.mariaComment #61
emma.mariaComment #62
emma.mariaComment #63
emma.mariaComment #64
emma.mariaComment #65
emma.mariaComment #66
emma.mariaComment #67
emma.mariaComment #68
emma.mariaComment #69
emma.mariaComment #70
emma.mariaComment #71
emma.mariaComment #72
emma.mariaComment #73
emma.mariaComment #74
emma.mariaComment #75
emma.mariaComment #76
emma.mariaLet's get this rolling again!
Comment #78
emma.mariaComment #92
Feuerwagen