Skip to content

Latest commit

 

History

History
56 lines (43 loc) · 2.84 KB

2-integrate-react-drupal-theme.md

File metadata and controls

56 lines (43 loc) · 2.84 KB

Integrate React with a Custom Drupal Theme

back to main project README

Summary

The goal for this exercise is to create a custom Drupal theme that includes a React app as part of its codebase. The React app will be stored in its own directory within the theme and will be attached to a theme template using libraries.yml.

For an additional challenge, you may have this app display conditionally based on the value of a custom field on a content type. You can also try adding a second React app and configuring the apps to share dependencies between them.

Acceptance Criteria

  • A new custom drupal theme has been created
    • The theme can be created manually or using the Starterkit theme generator
  • A React app has been added to the theme
  • A library pointing to the production build of the React app has been created in THEME_NAME.libraries.yml
  • The React app has been added to a theme template and is shown on at least one page on the site
  • [Challenge] A boolean field has been added to a content type and the React app will only show on the page if that custom field is set to true
  • [Challenge] Multiple React apps are added to the same page and both apps utilize the same 'react' and 'react-dom' dependencies

Helpful Resources

Extra Challenge Resources

Setup Instructions

Skip to step 3 if Docker and DDEV are already installed.

  1. Install Docker or Colima
  2. Install DDEV
  3. Clone this repo to your local machine
  4. cd to the root of the project
  5. Run the setup commands below in you terminal
ddev start
ddev composer install
ddev site-install p2

Run the launch command to open the site unauthenticated

ddev launch

Or run the drush user login command to generate a one-time login

ddev drush uli