title |
---|
LocalGov Base Theme |
Welcome to the LocalGov Drupal base theme.
We developed this theme with scalability, ease of use, and ease of customisation in mind. Making this base theme a great start point for any website using the LocalGov Drupal distribution.
Instead of creating documentation for the theme and storing it in a wiki or something else that is likely to not be updated, we have written detailed comments inline with the code. This should make it easier to know exactly what code block any specific documentation item refers to.
The theme includes an automatically-generated list of all the CSS variables in variables.md.
To create a sub-theme, you simply need to run the sub-theme creation script that is in the /scripts
directory, like so:
cd web/themes/contrib/localgov_base/
bash scripts/create_subtheme.sh
You need to enter two items when creating a sub-theme:
- The name of the theme, this can be anything and can include spaces, e.g. Super Council
- The machine name for the theme, this must start with a letter and use only lowercase letters and underscores, e.g. super_council
Hopefully most of the custom styles you will need are set via CSS custom properties in the /css/variables.css
file in your sub-theme.
This is where you set your colours, fonts, spacing, etc. Then you "apply" these variables where needed, like so:
:root {
/* Set/Override Variables */
--color-accent: red;
--spacing-largest: 5rem;
/* Apply Variables */
--color-link: var(--color-accent);
--breadcrumbs-background-color: var(--color-accent);
--section-spacing-vertical-header: var(--spacing-largest);
}
If you need to add any CSS overides, you can create custom CSS files for these and then a library/libraries to attach them to your components.
To make sure we follow Drupal's CSS coding standards (without having to think about it), there is a handy npm
script to automatically scan and fix any CSS coding standards violations.
Simple run npm install
to get the necessary packages, then run npm start
to scan the files and fix any issues.
This project is currently maintained by:
- Mark Conroy https://github.com/markconroy
- Maria Young https://github.com/msayoung