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

#1: Add additional detail to README files and update starter_theme machine name #25

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 6 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,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
Expand Down
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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.
File renamed without changes.
File renamed without changes.
15 changes: 10 additions & 5 deletions starter_theme/README.md → source_theme_name/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# 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/
NVM: https://github.com/nvm-sh/nvm

## Getting started

### Installing the node package dependencies and running a build
### 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.
```
nvm use
npm install
Expand All @@ -24,7 +29,7 @@ npm install
npm run dev
```

### Building the assets for deployment
### Building the assets for deployment.
```
npm run build
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "uswds_theme",
"name": "source_theme_name",
"version": "3.0.0",
"description": "",
"main": "index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base:
dependencies:
- starter_theme/uswds
- starter_theme/external_links
- source_theme_name/uswds
- source_theme_name/external_links

uswds:
css:
Expand Down
13 changes: 13 additions & 0 deletions source_theme_name/source_theme_name.theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/**
* @file
* Functions to support theme templates.
*/

/**
* Implements hook_preprocess().
*/
function source_theme_name_preprocess(&$variables) {
$variables['uswds_img_path'] = '/themes/custom/source_theme_name/dist/assets/img';
}
13 changes: 0 additions & 13 deletions starter_theme/starter_theme.theme

This file was deleted.