A simple, Twig-based component builder and styleguide compatible with Drupal.
$ composer install
Most components are standalone, self-documenting .twig files, with independent .css and .js files organized into libraries.
Although components are meant to be standalone, they share certain 'schemes' that they can optionally honor.
cu-colorscheme--- Currently implemented. Any component can choose to deal with things like padding when a colorscheme is set.cu-layoutscheme--- Proposed. The first option would be--reversed. Any component that has top-down or right-left layouts could choose to honor this and flip if/when set. It would replace some component-specific variants, since it's so common.cu-spacingscheme--- Proposed. This scheme would mostly affect the outer margins of components. Currently component margins are inconsistent, and a design-system-global setting like this could help. Values could be things likenone,compact,airy.
Component example:
components/button/
├── buttons.data.yml
├── button.twig
├── button.css
└── button.libraries.yml
Library example:
# button.libraries.yml
css:
button.css: {}
js:
button.js: {}
dependencies:
- base
Union Organizer is a custom Drupal module that configures Twig namespacing and adds components and skins as Drupal libraries. See the Union Organizer readme for installation and documentation.
Abstracts Drupal Attribute functionality so that attributes can be dynamically created or added to from within a template. See the form component.
- Refactor colors. Define names in global but actual colors in skins.
- In all cases, skin CSS should be loaded after component CSS.
- Cleaner separation of component and skin typography.