Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rationalise templates and CSS #61

Open
markconroy opened this issue Apr 8, 2024 · 0 comments
Open

Rationalise templates and CSS #61

markconroy opened this issue Apr 8, 2024 · 0 comments

Comments

@markconroy
Copy link
Member

We seem to have a lot of templates in our ecc_theme. I think we could significantly reduce the number we have, which will make this much easier to maintain, update, document and test.

For example, we have many templates for 'anonymous' and logged in users. I reckon each of these could become one template, if a simple check to see if someone is logged in or not.

For example

  • node--localgov-news-article--card-anonymous.html.twig
  • node--localgov-news-article--card.html.twig

The only difference I can see with these two templates is where the date field is printed. That should be an easy fix. And the same approach can be taken to the other similar anonymous vs logged-in templates.

Next, we have a lot of templates for specific view modes for specific content types - node templates for teasers for news and events and etc. We should have 1 design pattern for teasers, and all content types should use the same node--teaser.html.twig file. They will then all also use the same teaser.css file.

If we need another design pattern for cards, then we can create a view mode called 'Card' and a template node--card.html.twig and let all content types use that for their card view mode along with a card.css file. If we look at the news.css file in ecc_theme, we can see generic classes such as .card-content being styled here with no qualifier to say .news .card-content. This means if any other template uses the .card-content class (such as node--card.html.twig) then styles from the news.css file will bleed in here. The only CSS we should have in news.css is CSS that directly related to the news content type. All other CSS that is relevant to a card design pattern should be moved to a card.css file so it applies where it should without causing unintended consequences.

This is just some off-the-top-of-my-head thoughts. We should do a full review of the theme to flesh it all out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant