From 7ae25c9b5e1940759e2977f5c74808459f614ef3 Mon Sep 17 00:00:00 2001 From: Ray Estrada Date: Fri, 13 Dec 2024 16:51:01 -0800 Subject: [PATCH 1/2] #1 Add additional detail to README files Update starter_theme name to source_theme_name --- .github/dependabot.yml | 2 +- CONTRIBUTING.md | 14 ++++------- README.md | 25 ++++++++++++------- .../.gitignore | 0 {starter_theme => source_theme_name}/.nvmrc | 0 .../README.md | 14 +++++++---- .../block.block.bixaluswds_main_menu.yml | 4 +-- .../block.block.bixaluswds_sitebranding.yml | 4 +-- .../block.block.source_theme_name_content.yml | 6 ++--- ...block.block.source_theme_name_messages.yml | 6 ++--- ...ock.block.source_theme_name_page_title.yml | 6 ++--- ....source_theme_name_primary_local_tasks.yml | 6 ++--- .../gulpfile.js | 0 {starter_theme => source_theme_name}/logo.svg | 0 .../package.json | 2 +- .../source_theme_name.info.yml | 5 ++-- .../source_theme_name.libraries.yml | 4 +-- .../source_theme_name.starterkit.yml | 0 source_theme_name/source_theme_name.theme | 13 ++++++++++ .../src/js/external-links.js | 0 .../src/js/theme-switcher.js | 0 .../src/sass/_uswds-settings.scss | 0 .../src/sass/styles.scss | 0 starter_theme/starter_theme.theme | 13 ---------- 24 files changed, 66 insertions(+), 58 deletions(-) rename {starter_theme => source_theme_name}/.gitignore (100%) rename {starter_theme => source_theme_name}/.nvmrc (100%) rename {starter_theme => source_theme_name}/README.md (68%) rename {starter_theme => source_theme_name}/config/install/block.block.bixaluswds_main_menu.yml (88%) rename {starter_theme => source_theme_name}/config/install/block.block.bixaluswds_sitebranding.yml (88%) rename starter_theme/config/install/block.block.starter_theme_content.yml => source_theme_name/config/install/block.block.source_theme_name_content.yml (76%) rename starter_theme/config/install/block.block.starter_theme_messages.yml => source_theme_name/config/install/block.block.source_theme_name_messages.yml (76%) rename starter_theme/config/install/block.block.starter_theme_page_title.yml => source_theme_name/config/install/block.block.source_theme_name_page_title.yml (73%) rename starter_theme/config/install/block.block.starter_theme_primary_local_tasks.yml => source_theme_name/config/install/block.block.source_theme_name_primary_local_tasks.yml (74%) rename {starter_theme => source_theme_name}/gulpfile.js (100%) rename {starter_theme => source_theme_name}/logo.svg (100%) rename {starter_theme => source_theme_name}/package.json (93%) rename starter_theme/starter_theme.info.yml => source_theme_name/source_theme_name.info.yml (81%) rename starter_theme/starter_theme.libraries.yml => source_theme_name/source_theme_name.libraries.yml (80%) rename starter_theme/starter_theme.starterkit.yml => source_theme_name/source_theme_name.starterkit.yml (100%) create mode 100644 source_theme_name/source_theme_name.theme rename {starter_theme => source_theme_name}/src/js/external-links.js (100%) rename {starter_theme => source_theme_name}/src/js/theme-switcher.js (100%) rename {starter_theme => source_theme_name}/src/sass/_uswds-settings.scss (100%) rename {starter_theme => source_theme_name}/src/sass/styles.scss (100%) delete mode 100644 starter_theme/starter_theme.theme diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0161920..e1df80c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,7 +6,7 @@ version: 2 updates: - package-ecosystem: "npm" # See documentation for possible values - directory: "/starter_theme/" # Location of package manifests + directory: "/source_theme_name/" # Location of package manifests schedule: interval: "weekly" labels: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df5c6f9..1d4e6fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,18 +10,14 @@ ### Initialize child theme using drupal theme generate function Determine what theme machine name you want to use in this example we are using `my_new_theme`. -First create a `custom` directory in `themes` directory if there isn't one: `mkdir web/themes/custom`. ``` -lando php web/core/scripts/drupal generate-theme --starterkit starter_theme my_new_theme --path themes/custom -lando drush cr -``` - -### Remove these lines from your custom theme .info.yml file +# First create a `custom` directory in `themes` directory. +mkdir -p web/themes/custom -``` -hidden: true -starterkit: true +# Generate the theme using Drupal's built in theme generation and starterkit from Bixal USWDS theme. +lando php web/core/scripts/drupal generate-theme --starterkit source_theme_name my_new_theme --path themes/custom +lando drush cr ``` ### Install and set your custom theme as the default diff --git a/README.md b/README.md index ce0169d..1a3b59b 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ # Bixal USWDS Drupal base theme -@TODO document the process to create a new child theme from the starter_theme. +## Introduction +Bixal's USWDS Drupal base theme is expected to be installed and not modified in a project. It includes a baseline of functions, configuration and templates for new projects. The base theme also includes a starterkit for generating a custom theme per project. -## Install base theme by modifying composer.json file -Add bixal/bixaluswds to `repositories` object. +**\*\*WARNING!\*\*: DO NOT clone** this theme into your project codebase! If you plan to contribute follow the instructions instead written in [CONTRIBUTING.md](CONTRIBUTING.md). + +## 1. Install base theme by modifying composer.json file. +To configure the installation of the base theme in the contrib themes directory add bixal/bixaluswds to `repositories` object in `composer.json`. ``` { "type": "package", @@ -19,17 +22,21 @@ Add bixal/bixaluswds to `repositories` object. } } ``` -Then run +Then run this to install. ``` lando composer require "bixal/bixaluswds" ``` -## Initialize child theme using drupal theme generate function -Determine what theme name you want to use in this example we are using `my_new_theme`. -First create a `custom` directory in `themes` directory if there isn't one `mkdir web/themes/custom`. +## 2. Initialize child theme using drupal theme generate function. +Determine what theme name you want to use. In this example we are using `my_new_theme`. ``` -lando php web/core/scripts/drupal generate-theme --starterkit starter_theme my_new_theme --path themes/custom +# First create a `custom` directory in `themes` directory. +mkdir -p web/themes/custom + +# Generate the theme using Drupal's built in theme generation and starterkit from Bixal USWDS theme. +lando php web/core/scripts/drupal generate-theme --starterkit source_theme_name my_new_theme --path themes/custom lando drush cr ``` -## Install the theme dependencies and set your custom theme as the default +## 3. Install the theme dependencies and set your custom theme as the default. +Follow instructions found in your new theme's README file to install dependencies and set your theme as the default. diff --git a/starter_theme/.gitignore b/source_theme_name/.gitignore similarity index 100% rename from starter_theme/.gitignore rename to source_theme_name/.gitignore diff --git a/starter_theme/.nvmrc b/source_theme_name/.nvmrc similarity index 100% rename from starter_theme/.nvmrc rename to source_theme_name/.nvmrc diff --git a/starter_theme/README.md b/source_theme_name/README.md similarity index 68% rename from starter_theme/README.md rename to source_theme_name/README.md index cea01d9..3b26c42 100644 --- a/starter_theme/README.md +++ b/source_theme_name/README.md @@ -1,8 +1,5 @@ # Bixal USWDS Drupal theme -@TODO Modify this starter_theme to work with core function to generate theme -https://www.drupal.org/docs/core-modules-and-themes/core-themes/starterkit-theme#s-custom-starterkit-theme - ## Requirements Node: https://nodejs.org/en/ @@ -10,7 +7,14 @@ NVM: https://github.com/nvm-sh/nvm ## Getting started -### Installing the node package dependencies and running a build +### Was this theme just created? set as the default theme otherwise continue to next steps. +In this example the theme machine name is `my_new_theme`. +The theme dependencies are already met in the Drupal standard installation. +``` +lando drush theme:install my_new_theme +``` + +### Installing the node package dependencies and running a build. ``` nvm use npm install @@ -24,7 +28,7 @@ npm install npm run dev ``` -### Building the assets for deployment +### Building the assets for deployment. ``` npm run build ``` diff --git a/starter_theme/config/install/block.block.bixaluswds_main_menu.yml b/source_theme_name/config/install/block.block.bixaluswds_main_menu.yml similarity index 88% rename from starter_theme/config/install/block.block.bixaluswds_main_menu.yml rename to source_theme_name/config/install/block.block.bixaluswds_main_menu.yml index 91bce50..3f5d88f 100644 --- a/starter_theme/config/install/block.block.bixaluswds_main_menu.yml +++ b/source_theme_name/config/install/block.block.bixaluswds_main_menu.yml @@ -6,9 +6,9 @@ dependencies: module: - system theme: - - starter_theme + - source_theme_name id: bixaluswds_main_menu -theme: starter_theme +theme: source_theme_name region: header weight: 0 provider: null diff --git a/starter_theme/config/install/block.block.bixaluswds_sitebranding.yml b/source_theme_name/config/install/block.block.bixaluswds_sitebranding.yml similarity index 88% rename from starter_theme/config/install/block.block.bixaluswds_sitebranding.yml rename to source_theme_name/config/install/block.block.bixaluswds_sitebranding.yml index 390b47b..34c8cac 100644 --- a/starter_theme/config/install/block.block.bixaluswds_sitebranding.yml +++ b/source_theme_name/config/install/block.block.bixaluswds_sitebranding.yml @@ -4,9 +4,9 @@ dependencies: module: - system theme: - - starter_theme + - source_theme_name id: bixaluswds_sitebranding -theme: starter_theme +theme: source_theme_name region: header weight: -2 provider: null diff --git a/starter_theme/config/install/block.block.starter_theme_content.yml b/source_theme_name/config/install/block.block.source_theme_name_content.yml similarity index 76% rename from starter_theme/config/install/block.block.starter_theme_content.yml rename to source_theme_name/config/install/block.block.source_theme_name_content.yml index 4c954e9..ae892db 100644 --- a/starter_theme/config/install/block.block.starter_theme_content.yml +++ b/source_theme_name/config/install/block.block.source_theme_name_content.yml @@ -4,9 +4,9 @@ dependencies: module: - system theme: - - starter_theme -id: starter_theme_content -theme: starter_theme + - source_theme_name +id: source_theme_name_content +theme: source_theme_name region: content weight: -3 provider: null diff --git a/starter_theme/config/install/block.block.starter_theme_messages.yml b/source_theme_name/config/install/block.block.source_theme_name_messages.yml similarity index 76% rename from starter_theme/config/install/block.block.starter_theme_messages.yml rename to source_theme_name/config/install/block.block.source_theme_name_messages.yml index 86fb5bd..a4fc51c 100644 --- a/starter_theme/config/install/block.block.starter_theme_messages.yml +++ b/source_theme_name/config/install/block.block.source_theme_name_messages.yml @@ -4,9 +4,9 @@ dependencies: module: - system theme: - - starter_theme -id: starter_theme_messages -theme: starter_theme + - source_theme_name +id: source_theme_name_messages +theme: source_theme_name region: admin weight: -3 provider: null diff --git a/starter_theme/config/install/block.block.starter_theme_page_title.yml b/source_theme_name/config/install/block.block.source_theme_name_page_title.yml similarity index 73% rename from starter_theme/config/install/block.block.starter_theme_page_title.yml rename to source_theme_name/config/install/block.block.source_theme_name_page_title.yml index e18205f..99836d7 100644 --- a/starter_theme/config/install/block.block.starter_theme_page_title.yml +++ b/source_theme_name/config/install/block.block.source_theme_name_page_title.yml @@ -2,9 +2,9 @@ langcode: en status: true dependencies: theme: - - starter_theme -id: starter_theme_page_title -theme: starter_theme + - source_theme_name +id: source_theme_name_page_title +theme: source_theme_name region: content weight: -4 provider: null diff --git a/starter_theme/config/install/block.block.starter_theme_primary_local_tasks.yml b/source_theme_name/config/install/block.block.source_theme_name_primary_local_tasks.yml similarity index 74% rename from starter_theme/config/install/block.block.starter_theme_primary_local_tasks.yml rename to source_theme_name/config/install/block.block.source_theme_name_primary_local_tasks.yml index 13229d3..4095cb4 100644 --- a/starter_theme/config/install/block.block.starter_theme_primary_local_tasks.yml +++ b/source_theme_name/config/install/block.block.source_theme_name_primary_local_tasks.yml @@ -2,9 +2,9 @@ langcode: en status: true dependencies: theme: - - starter_theme -id: starter_theme_primary_local_tasks -theme: starter_theme + - source_theme_name +id: source_theme_name_primary_local_tasks +theme: source_theme_name region: admin weight: -4 provider: null diff --git a/starter_theme/gulpfile.js b/source_theme_name/gulpfile.js similarity index 100% rename from starter_theme/gulpfile.js rename to source_theme_name/gulpfile.js diff --git a/starter_theme/logo.svg b/source_theme_name/logo.svg similarity index 100% rename from starter_theme/logo.svg rename to source_theme_name/logo.svg diff --git a/starter_theme/package.json b/source_theme_name/package.json similarity index 93% rename from starter_theme/package.json rename to source_theme_name/package.json index 5624016..f25fcfd 100644 --- a/starter_theme/package.json +++ b/source_theme_name/package.json @@ -1,5 +1,5 @@ { - "name": "uswds_theme", + "name": "source_theme_name", "version": "3.0.0", "description": "", "main": "index.js", diff --git a/starter_theme/starter_theme.info.yml b/source_theme_name/source_theme_name.info.yml similarity index 81% rename from starter_theme/starter_theme.info.yml rename to source_theme_name/source_theme_name.info.yml index e51ba17..8a5db95 100644 --- a/starter_theme/starter_theme.info.yml +++ b/source_theme_name/source_theme_name.info.yml @@ -1,13 +1,14 @@ -name: Bixal USWDS starter theme +name: Bixal USWDS source theme type: theme description: "Drupal theme for use with USWDS." core_version_requirement: "^10" base theme: bixaluswds version: '0.0.0' hidden: true +starterkit: true libraries: - - starter_theme/base + - source_theme_name/base regions: admin: "Admin" diff --git a/starter_theme/starter_theme.libraries.yml b/source_theme_name/source_theme_name.libraries.yml similarity index 80% rename from starter_theme/starter_theme.libraries.yml rename to source_theme_name/source_theme_name.libraries.yml index 03666ca..d248e8a 100644 --- a/starter_theme/starter_theme.libraries.yml +++ b/source_theme_name/source_theme_name.libraries.yml @@ -1,7 +1,7 @@ base: dependencies: - - starter_theme/uswds - - starter_theme/external_links + - source_theme_name/uswds + - source_theme_name/external_links uswds: css: diff --git a/starter_theme/starter_theme.starterkit.yml b/source_theme_name/source_theme_name.starterkit.yml similarity index 100% rename from starter_theme/starter_theme.starterkit.yml rename to source_theme_name/source_theme_name.starterkit.yml diff --git a/source_theme_name/source_theme_name.theme b/source_theme_name/source_theme_name.theme new file mode 100644 index 0000000..177c004 --- /dev/null +++ b/source_theme_name/source_theme_name.theme @@ -0,0 +1,13 @@ + Date: Fri, 13 Dec 2024 17:12:55 -0800 Subject: [PATCH 2/2] Add config to set new theme as default --- CONTRIBUTING.md | 1 + source_theme_name/README.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d4e6fc..541f066 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,6 +27,7 @@ The theme dependencies are already met in the Drupal standard installation. ``` lando drush theme:install my_new_theme +lando drush config-set system.theme default my_new_theme ``` ## 3. Work on an issue diff --git a/source_theme_name/README.md b/source_theme_name/README.md index 3b26c42..e5e18ee 100644 --- a/source_theme_name/README.md +++ b/source_theme_name/README.md @@ -7,11 +7,12 @@ NVM: https://github.com/nvm-sh/nvm ## Getting started -### Was this theme just created? set as the default theme otherwise continue to next steps. +### Was this theme just generated? set as the default theme, otherwise continue to next step. In this example the theme machine name is `my_new_theme`. The theme dependencies are already met in the Drupal standard installation. ``` lando drush theme:install my_new_theme +lando drush config-set system.theme default my_new_theme ``` ### Installing the node package dependencies and running a build.