Advertising sustains the DA. Ads are hidden for members. Join today

How to start a new theme

Last updated on
2 November 2023

A new theme named my_new_theme can be generated by following the next steps:

  1. Clone “The Governor” theme in the “web/themes/custom/” folder. (This step will be replaced by composer require in the future.)

  2. Run the generate-theme command from the root the project:

    php web/core/scripts/drupal generate-theme my_new_theme --name "My New Theme" --description "Custom theme generated from The Governor" --path "themes/custom" --starterkit=governor

  3. Navigate to your new generated theme:

    cd web/themes/custom/my_new_theme

  4. Install the theme dependencies:

    npm install

  5. Run the init command to copy the USWDS assets and compile the styles:

    npm run init

  6. Clear cache:

    drush cr

  7. Enable your new theme and enjoy.

Help improve this page

Page status: No known problems

You can: