emanaton / govcms-uswds-drupal
Project template for Drupal 9 projects with a relocated document root
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:CSS
Type:project
Requires
- composer/installers: ^1.9
- cweagans/composer-patches: ^1.7
- drupal-ckeditor-libraries-group/fakeobjects: ^4.20
- drupal/address: ^1.12
- drupal/addtoany: ^2.0
- drupal/admin_toolbar: ^3.4
- drupal/admin_toolbar_links_access_filter: ^3.0
- drupal/admin_user_language: ^1.2
- drupal/allowed_formats: ^3.0
- drupal/auditfiles: ^4.1@beta
- drupal/auto_entitylabel: ^3.0
- drupal/backup_migrate: ^5.0@RC
- drupal/better_exposed_filters: ^6.0
- drupal/block_class: ^4.0
- drupal/block_content_permissions: ^1.11
- drupal/block_content_suggestions: ^1.0
- drupal/block_exclude_pages: ^2.1@beta
- drupal/block_field: ^1.0@RC
- drupal/block_permissions: ^1.3
- drupal/calendar_link: ^3.0
- drupal/ckeditor: ^1.0
- drupal/ckeditor5_show_block: ^1.9
- drupal/color_field: ^3.0
- drupal/conditional_fields: ^4.0@alpha
- drupal/config_filter: ^2.4
- drupal/config_ignore: ^3.3
- drupal/config_pages: ^2.15
- drupal/config_split: ^2.0@beta
- drupal/content_type_clone: ^1.1
- drupal/core-composer-scaffold: 10.3.13
- drupal/core-project-message: 10.3.13
- drupal/core-recommended: 10.3.13
- drupal/csv_importer: ^1.16
- drupal/csv_serialization: ^4.0
- drupal/ctools: ^4.1
- drupal/custom_meta: ^2.1
- drupal/devel: ^5.1
- drupal/devel_entity_updates: ^4.2
- drupal/diff: ^1.1
- drupal/easy_breadcrumb: ^2.0
- drupal/entity_clone: ^2.0@beta
- drupal/entityconnect: ^2.0@RC
- drupal/entityqueue: ^1.7
- drupal/environment_indicator: ^4.0
- drupal/extlink: 1.7
- drupal/fakeobjects: ^1.2
- drupal/feeds: ^3.0@beta
- drupal/feeds_ex: ^1.0@beta
- drupal/feeds_tamper: ^2.0@beta
- drupal/fences: ^3.0
- drupal/field_group: ^3.4
- drupal/file_replace: ^1.3
- drupal/filefield_paths: ^1.0@beta
- drupal/filter_perms: ^2.0@RC
- drupal/footnotes: ^3.1
- drupal/footnotes_all_block: 1.0.0-alpha2
- drupal/format_bytes: ^2.0
- drupal/fullcalendar_view: ^5.1
- drupal/gin: ^4.0
- drupal/hal: ^2.0
- drupal/honeypot: ^2.1
- drupal/hreflang: ^1.14
- drupal/imce: ^3.1
- drupal/imce_rename_plugin: ^2.0
- drupal/jquery_ui_autocomplete: ^2.0
- drupal/jsonapi_extras: ^3.24
- drupal/linkit: ^6.0
- drupal/masquerade: ^2.0@RC
- drupal/media_entity_download: ^2.3
- drupal/media_entity_file_replace: ^1.1
- drupal/menu_admin_per_menu: ^1.5
- drupal/menu_block: ^1.10
- drupal/menu_link_attributes: ^1.3
- drupal/metatag: ^2.0
- drupal/metatag_webform: ^1.0
- drupal/migrate_plus: ^6.0
- drupal/migrate_source_csv: ^3.4
- drupal/migrate_source_ui: ^1.0@RC
- drupal/migrate_tools: ^6.0
- drupal/moderated_content_bulk_publish: ^2.0
- drupal/moderation_sidebar: ^1.7
- drupal/node_revision_delete: ^1.0@RC
- drupal/override_node_options: ^2.7
- drupal/paragraphs: ^1.18
- drupal/paragraphs_asymmetric_translation_widgets: ^1.3
- drupal/pathauto: ^1.11
- drupal/pluginformalter: ^1.7
- drupal/purge: ^3.4
- drupal/quickedit: ^1.0
- drupal/rabbit_hole: ^1.0@beta
- drupal/redirect: ^1.6
- drupal/scanner: ^1.0@RC
- drupal/schema_metatag: ^3.0
- drupal/search_api: ^1.30
- drupal/search_api_location: 1.x-dev@dev
- drupal/selective_better_exposed_filters: ^3.0@beta
- drupal/semanticviews: ^3.1
- drupal/simple_sitemap: ^4.2
- drupal/single_content_sync: ^1.4
- drupal/sitemap: ^2.0@beta
- drupal/sitewide_alert: ^3.0
- drupal/svg_image_field: ^2.2
- drupal/tamper: ^1.0@alpha
- drupal/title_length: ^2.1
- drupal/token: ^1.9
- drupal/token_filter: ^2.2
- drupal/translatable_menu_link_uri: ^2.1
- drupal/transliterate_filenames: ^2.0
- drupal/twig_field_value: ^2.0
- drupal/twig_tweak: ^3.4
- drupal/twig_vardumper: ^3.1
- drupal/twig_xdebug: ^1.3
- drupal/ultimate_cron: ^2.0@beta
- drupal/uswds: ^2
- drupal/views_bulk_operations: ^4.3
- drupal/views_data_export: ^1.5
- drupal/viewsreference: ^2.0@beta
- drupal/webform: ^6.2.9
- drupal/webform_validation: ^2.0@alpha
- drupal/yaml_editor: ^1.2
- drupal/yearonly: ^9.1
- drush/drush: ^12.4.1
- mglaman/composer-drupal-lenient: ^1.0
- oomphinc/composer-installers-extender: ^2.0
- vlucas/phpdotenv: ^5.3
- webflo/drupal-finder: ^1.2
Conflicts
This package is auto-updated.
Last update: 2025-08-11 17:34:12 UTC
README
Installation
Prerequisites
- PHP 8.1 or higher
- Composer
- Node.js version 20 (managed with nvm)
- npm package manager
- MySQL/MariaDB or PostgreSQL database
- Web server (Apache/Nginx)
Setup Steps
-
Clone the repository
git clone [repository-url] cd govcmstemplate
-
Install PHP dependencies
composer install
-
Install and build theme dependencies
cd web/themes/custom/uswds_extend_custom nvm use 20 rm -rf node_modules npm install gulp build
-
Database setup
- Create a new database for your site
- Copy
web/sites/default/default.local.settings.php
toweb/sites/default/local.settings.php
- Configure database connection in
web/sites/default/local.settings.php
-
Install Drupal with configuration sync
The site has a predefined UUID in the existing configuration, so we need to install a base configuration first, then sync the site UUID, and finally import the full configuration.
drush site:install --existing-config -y --site-name="[YOUR_SITE_NAME]" --account-name=admin --account-pass=[YOUR_ADMIN_PASSWORD]
UUID Synchronization Process: Use the process outline here to synchronize the UUID, or use the
sync_site_uuid
defined below.
-
Fetch the current site UUID:
drush cget system.site uuid --format=string
-
Back up existing system site config file:
cp config/sync/system.site.yml config/sync/system.site.yml.backup
-
Replace UUID in system site config file (replace
[CURRENT_UUID]
with the UUID from the first command):sed -i.tmp "s/^uuid: .*/uuid: [CURRENT_UUID]/" "config/sync/system.site.yml" rm "config/sync/system.site.yml.tmp"
Import the configuration:
The config_split module requires multiple import runs to fully process configuration splits:
drush cr drush cim -y drush cr drush cim -y drush cr drush cim -y
-
Final theme build
cd web/themes/custom/uswds_extend_custom npm run build
-
Set file permissions
chmod -R 755 web/sites/default/files
Optional: Enable Sample Content
The govcsm_sample_content
module provides demonstration content showcasing the various paragraphs, blocks, menus, and other features available in this USWDS template. This is useful for:
- Exploring the available content types and paragraph components
- Understanding how different USWDS elements are implemented
- Having example content to reference when building your own pages
- Testing theme functionality with realistic data
To enable sample content:
drush en -y govcsm_sample_content
This will install:
- Sample pages demonstrating various paragraph types and layouts
- Taxonomy terms and vocabularies used by the content
- Example menus and navigation structures
- Demonstration data including tables and interactive elements
- Content showcasing USWDS components like heroes, cards, accordions, and more
Note: Sample content is intended for development and demonstration purposes. You may want to disable or remove this module before deploying to production.
Development Environment
For local development:
# Start development server ../vendor/bin/drush runserver # Watch for theme changes cd web/themes/custom/uswds_extend_custom npm run watch
Theme Architecture
This project uses a layered theme architecture built on the U.S. Web Design System (USWDS):
Theme Hierarchy
- USWDS Base Theme (
web/themes/contrib/uswds/
)
- Community contributed Drupal theme that serves as the foundation of our theme stack
- Provides core USWDS functionality and components
- USWDS Extend Theme (
web/themes/govcms/uswds_extend/
)
- Inherits from the base
uswds
theme - Provides enhanced functionality and components based on the U.S. Web Design System
- Acts as an intermediate layer between the base theme and custom implementations
- USWDS Extend Custom Theme (
web/themes/custom/uswds_extend_custom/
)
- Inherits from
uswds_extend
- Site-specific customization layer
- This is the theme that should be extended and customized for individual sites
- Contains project-specific styles, templates, and functionality
Theme Development
When customizing the theme for your site:
- Make modifications in
web/themes/custom/uswds_extend_custom/
- Avoid directly modifying the base
uswds
oruswds_extend
themes - Follow the USWDS Design System guidelines for consistent implementation
Advanced Setup
UUID Synchronization Helper Function
For easier UUID management, you can use this bash function (add to your .bashrc
or .zshrc
):
sync_site_uuid () { local config_file="config/sync/system.site.yml" if [ ! -f "$config_file" ] then echo "Error: Config file not found: $config_file" return 1 fi echo "Getting current site UUID..." local current_uuid=$(drush cget system.site uuid --format=string) if [ $? -ne 0 ] || [ -z "$current_uuid" ] then echo "Error: Failed to get site UUID from drush" return 1 fi echo "Current site UUID: $current_uuid" local config_uuid=$(grep "^uuid:" "$config_file" | sed 's/uuid: //') echo "Config file UUID: $config_uuid" if [ "$current_uuid" = "$config_uuid" ] then echo "UUIDs already match. No changes needed." return 0 fi cp "$config_file" "${config_file}.backup" echo "Created backup: ${config_file}.backup" sed -i.tmp "s/^uuid: .*/uuid: $current_uuid/" "$config_file" rm "${config_file}.tmp" echo "Updated UUID in $config_file" echo "Old UUID: $config_uuid" echo "New UUID: $current_uuid" local new_config_uuid=$(grep "^uuid:" "$config_file" | sed 's/uuid: //') if [ "$new_config_uuid" = "$current_uuid" ] then echo "✓ UUID successfully updated in config file" else echo "✗ Error: UUID update failed" return 1 fi }
Visual Regression Testing
- Install BackstopJS globally:
npm install -g backstopjs
- Navigate to the
web/
directory - Run
backstop reference
to capture screenshots from production site - Run
backstop test
to capture screenshots from local site - View the report at
https://[YOUR_LOCAL_DOMAIN]/backstop_data/html_report/
Theme Architecture
This project uses a layered theme architecture built on the U.S. Web Design System (USWDS):
Theme Hierarchy
- USWDS Base Theme (
web/themes/contrib/uswds/
)
- Community contributed Drupal theme that serves as the foundation of our theme stack
- Provides core USWDS functionality and components
- USWDS Extend Theme (
web/themes/govcms/uswds_extend/
)
- Inherits from the base
uswds
theme - Provides enhanced functionality and components based on the U.S. Web Design System
- Acts as an intermediate layer between the base theme and custom implementations
- USWDS Extend Custom Theme (
web/themes/custom/uswds_extend_custom/
)
- Inherits from
uswds_extend
- Site-specific customization layer
- This is the theme that should be extended and customized for individual sites
- Contains project-specific styles, templates, and functionality
Theme Development
When customizing the theme for your site:
- Make modifications in
web/themes/custom/uswds_extend_custom/
- Avoid directly modifying the base
uswds
oruswds_extend
themes - Follow the USWDS Design System guidelines for consistent implementation