Problem/Motivation

In #2348543: [meta] Consensus Banana Phase 2, transition templates to the starterkit theme we moved a lot of templates from modules to Classy, the CSS that relies on the classes in Classy is still in the modules files

Proposed resolution

Move the CSS that relies on the HTML classes for every module. Ensure that the classes aren't being added in the module.

Remaining tasks

User interface changes

None for Classy, Stark will be more Stark

API changes

None

CommentFileSizeAuthor
#50 move_file_theme_css_to-2489566-50.patch10 KBdavidhernandez
#47 interdiff-2489566-45-47.txt397 bytesrainbowarray
#47 2489566-47-move-file-css-classy.patch9.96 KBrainbowarray
#45 interdiff-2489566-40-45.txt1.86 KBrainbowarray
#45 2489566-45-move-file-css-classy.patch9.94 KBrainbowarray
#40 interdiff-38-40.txt4.21 KBemma.maria
#40 2489566-40-move-file-css-classy.patch20.8 KBemma.maria
#38 interdiff-2489566-37-38.txt1.45 KBrainbowarray
#38 2489566-38-move-file-css-classy.patch11.06 KBrainbowarray
#37 2489566-37-move-file-css-classy.patch11.12 KBrainbowarray
#29 move_file_theme_css_to-2489566-29.patch11.07 KBlewisnyman
#29 interdiff.txt4.02 KBlewisnyman
#26 move_file_theme_css_to-2489566-26.patch12.22 KBlewisnyman
#26 interdiff.txt10.29 KBlewisnyman
#17 move_file_theme_css-2489566-screenshots.json_.txt202 bytesaxe312
#16 screenshot--2474091--node-1-edit_0.diff.png152.18 KBaxe312
#16 screenshot--2474091--node-1--node-view-mode-full-greater-node__content_0.diff.png339.98 KBaxe312
#16 move_file_theme_css-2489566-16.patch11.53 KBaxe312
#15 move_file_theme_css_to-2489566-15.patch12.59 KBchernous_dn
#13 move_file_theme_css_to-2489566-13.patch12.59 KBchernous_dn
#2 file-to-classy-2489566-2.patch4.92 KBmanjit.singh
#4 file-to-classy-2489566-4.patch6.68 KBmanjit.singh
#8 before.png18.23 KBchernous_dn
#8 after.png18.13 KBchernous_dn
#8 before_edit.png15.8 KBchernous_dn
#8 after_edit.png21.13 KBchernous_dn
#8 style_include.png33.44 KBchernous_dn
#8 move_file_theme_css_to-2489566-8.patch12.07 KBchernous_dn

Comments

manjit.singh’s picture

Assigned: Unassigned » manjit.singh
manjit.singh’s picture

Assigned: manjit.singh » Unassigned
Status: Active » Needs review
StatusFileSize
new4.92 KB
lewisnyman’s picture

Component: contextual.module » file.module
Status: Needs review » Needs work

There are three situations where we are adding the css file through a library, we need to remove them and make sure we are loading these files in the right places in Classy.

core/modules/file/src/Element/ManagedFile.php:
   46        '#extended' => FALSE,
   47        '#attached' => [
   48:         'library' => ['file/drupal.file'],
   49        ],
   50      ];

core/modules/file/src/Plugin/Field/FieldFormatter/GenericFileFormatter.php:
   50      if (!empty($elements)) {
   51        $elements['#attached'] = array(
   52:         'library' => array('file/drupal.file.formatter.generic'),
   53        );
   54      }

core/modules/file/src/Plugin/Field/FieldType/FileItem.php:
  114      $element = array();
  115  
  116:     $element['#attached']['library'][] = 'file/drupal.file';
  117  
  118      $element['display_field'] = array(
manjit.singh’s picture

Status: Needs work » Needs review
StatusFileSize
new6.68 KB

Done with the changes mentioned in #3. Please verify.

sqndr’s picture

+++ b/core/modules/file/src/Plugin/Field/FieldFormatter/GenericFileFormatter.php
@@ -48,9 +48,6 @@ public function viewElements(FieldItemListInterface $items) {
-      $elements['#attached'] = array(
-        'library' => array('file/drupal.file.formatter.generic'),
-      );

I don't think this can be removed since it's a different library?

lauriii’s picture

Status: Needs review » Needs work
Issue tags: +Needs screenshots
mortendk’s picture

chernous_dn’s picture

StatusFileSize
new12.07 KB
new33.44 KB
new21.13 KB
new15.8 KB
new18.13 KB
new18.23 KB

Update #4 patch.
@LewisNyman I think we dont need remove 'library' => ['file/drupal.file'] and $element['#attached']['library'][] = 'file/drupal.file'
Because in drupal.file used file.js and dependencies to core/jquery and etc.
We need remove only component:css/file.theme.css: {}.
Вut we can remove drupal.file.formatter.generic: and include in classy in template file-managed-file.html.twig.
Also I moved icons to classy. Tested and add screenshots.

chernous_dn’s picture

Status: Needs work » Needs review

The last submitted patch, 8: move_file_theme_css_to-2489566-8.patch, failed testing.

The last submitted patch, 8: move_file_theme_css_to-2489566-8.patch, failed testing.

chernous_dn’s picture

StatusFileSize
new12.59 KB

I have some error in patch #8. Update patch.

Status: Needs review » Needs work

The last submitted patch, 13: move_file_theme_css_to-2489566-13.patch, failed testing.

chernous_dn’s picture

Status: Needs work » Needs review
StatusFileSize
new12.59 KB

Trying fix patch #13. Include style to file-link.html.twig. And remove from include style field.html.twig.

axe312’s picture

Here is a new version of the patch. I moved the file icons within a separate folder. Having them into the root dir of classy seemed so wrong.

I could not find any differences via visual regression testing after applying the patch.

axe312’s picture

I attached the json config file for the visual regression testing I did. I used the drupalcore-frontend-toolkit to create the screenshots. See here: https://github.com/lewisnyman/drupalcore-frontend-toolkit/pull/15

lewisnyman’s picture

Component: file.module » Classy theme
Issue tags: +Needs subsystem maintainer review

Great. Thanks for the work here. This is the first issue where we have added image to Classy, we need a review from a Classy maintainer to ensure that the folder structure is correct.

lauriii’s picture

Status: Needs review » Needs work
+++ b/core/themes/classy/classy.libraries.yml
@@ -14,10 +14,16 @@ drupal.comment.threaded:
\ No newline at end of file

New line needed to the end of file

mortendk’s picture

Assigned: Unassigned » mortendk

yes we are first moving the css files over into css/[*modulename*]/foo.css then were probably gathering them afterwads in /css/*.css or some other naming conversion
so the naming is correct :)

mortendk’s picture

Assigned: mortendk » Unassigned
davidhernandez’s picture

Hmm. Something's not right here. Right now the Book CSS was added into a "navigation" folder, matching the organization of the templates folder. But comment and search were not. They were added in folders that matched the module they came from. We need one or the other.

Also, the files are being moved with *.theme in the name. I thought we were going to remove that since we aren't going to move any *.module files to Classy so there is no need for the differentiation.

mortendk’s picture

@david as i recall the discussion back in LA - was that we first move all the css files, then we rename em etc, the same way as we did with moving the template files to classy ? or did i get that wrong, it was something about "more important to move them instead of discussing names for each file

davidhernandez’s picture

@morten, I think we did have that conversation. So that is right. But at this point, with the amount of time that has passed and how close we are to RC, I think we need to start eliminating the two step processes. There is no guarantee we'll get follow ups in, so we should decide on naming and folder structure, and have these patches go in that way.

lewisnyman’s picture

Ok that sounds good, it makes sense to remove the .theme. stuff in Classy because it's the same convention we follow in Seven and Bartik.

lewisnyman’s picture

Status: Needs work » Needs review
StatusFileSize
new10.29 KB
new12.22 KB

Ok, I've renamed the folder structure to match the templates and I've rename the file to file.css. I've also renamed the folder to icons, which feels more appropriate if we want to put more stuff in there.

davidhernandez’s picture

Should these just go in a components folder? My concern is about the stuff we will move that is not directly tied to a template. What will we do with all the system CSS we just split? Are we going to move that all over as the "components" folder and leave the other CSS in template-based folders? That would seem inconsistent with how we organize the other themes, which is SMACSS-based.

lewisnyman’s picture

@davidhernandez I was also thinking about this today and realised that splitting the CSS in to separate folders really harms findability. One of the benefits of having one component per file is it's really easy to find the file when they are sorted alphabetically. This makes it a lot harder.

TLDR I agree and will write a new patch to move the CSS file structure inline with Seven and Bartik

lewisnyman’s picture

mortendk’s picture

im fine with moving all the css files into /css/*.css - the only reason ive been anal about it was to follow the guidelines we agreed on in LA, so we first moved em over then we renamed etc. It makes a ton more sense to just do it one go & we seem to agree upon it so +1

lewisnyman’s picture

Thanks, this just needs manual testing to make sure the new patch hasn't introduced regressions and I haven't messed up the image paths :)

joginderpc’s picture

Assigned: Unassigned » joginderpc
Issue tags: +tested manual

Patch is working fine tested on my system.

lewisnyman’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs manual testing, -Novice, -tested manual

Thank you!

lewisnyman’s picture

Assigned: joginderpc » Unassigned
lauriii’s picture

+++ b/core/themes/classy/classy.libraries.yml
@@ -8,16 +8,22 @@ book-navigation:
-      css/navigation/book.theme.css: {}
+      css/components/book.theme.css: {}
...
-      css/comment/comment.theme.css: {}
+      css/components/comment.theme.css: {}
...
-      css/search/search.theme.css: {}
+      css/components/search.theme.css: {}

Can someone explain why is these changes in this patch?

davidhernandez’s picture

Status: Reviewed & tested by the community » Needs work

We agreed to put the css files into the components folder, so maybe Lewis was testing it and included it by accident? Even if we tried to sneak it in :) the names should be changed too. Anyway, lets make a separate issue for fixing that.

rainbowarray’s picture

Status: Needs work » Needs review
StatusFileSize
new11.12 KB

Reroll.

rainbowarray’s picture

StatusFileSize
new11.06 KB
new1.45 KB

This is fixing the file names. I didn't split off the the file renames for search, comment and book into another issue. If someone wants to open that, it would be straightforward.

Or.... just change the issue title. :)

lauriii’s picture

Status: Needs review » Needs work
+++ b/core/themes/classy/classy.libraries.yml
@@ -26,4 +26,10 @@ search.results:
-      css/search/search.theme.css: {}
+      css/components/search.css: {}
...
diff --git a/core/themes/classy/css/navigation/book.theme.css b/core/themes/classy/css/components/book.css

similarity index 100%
rename from core/themes/classy/css/navigation/book.theme.css

rename from core/themes/classy/css/navigation/book.theme.css
rename to core/themes/classy/css/components/book.css

rename to core/themes/classy/css/components/book.css
diff --git a/core/themes/classy/css/comment/comment.theme.css b/core/themes/classy/css/components/comment.css

diff --git a/core/themes/classy/css/comment/comment.theme.css b/core/themes/classy/css/components/comment.css
similarity index 100%

similarity index 100%
rename from core/themes/classy/css/comment/comment.theme.css

rename from core/themes/classy/css/comment/comment.theme.css
rename to core/themes/classy/css/components/comment.css

We still have unrelated changes in the patch :)

emma.maria’s picture

Status: Needs work » Needs review
StatusFileSize
new20.8 KB
new4.21 KB

I have removed any changes relating to book, comment and search.

Patch and interdiff attached.

lauriii’s picture

Status: Needs review » Needs work

Thanks for the fix!

+++ b/core/themes/classy/classy.libraries.yml
@@ -27,3 +27,9 @@ search.results:
+drupal.file:

s/drupal.file/file

You could also take a look on the Git configuration documentation to make reviewing of your patches that do moving of files a little easier :)

lewisnyman’s picture

The only

+++ b/core/themes/classy/classy.libraries.yml
@@ -27,3 +27,9 @@ search.results:
+drupal.file:

I wonder if we can just call this library file? The drupal part seem redundant.

davidhernandez’s picture

Yes, no drupal.* please. I don't think it is necessary for any of the libraries.

subhojit777’s picture

Issue tags: +Novice

Quite clear in #41 / #42 / #43 what to do next.

rainbowarray’s picture

Status: Needs work » Needs review
Issue tags: -Novice
StatusFileSize
new9.94 KB
new1.86 KB

This should fix the remaining concerns.

lewisnyman’s picture

Status: Needs review » Needs work
+++ b/core/themes/classy/classy.libraries.yml
@@ -27,3 +27,9 @@ search.results:
+    theme:
+      css/components/file.css: {}

We've just been having this whole component/theme discussion in other issues. These should be component files.

rainbowarray’s picture

Status: Needs work » Needs review
StatusFileSize
new9.96 KB
new397 bytes
lewisnyman’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the interdiff

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Needs a reroll.

davidhernandez’s picture

Status: Needs work » Needs review
StatusFileSize
new10 KB

rerolled.

lewisnyman’s picture

Status: Needs review » Postponed

This looks good, setting to RTBC/postponed on #2566771: [Voltron patch] Move all remaining *.theme.css to Classy

akalata’s picture

Status: Postponed » Closed (fixed)