From e868f2fb8c7966edad048b0f36a069039998e736 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 29 Oct 2020 00:12:50 +0000 Subject: [PATCH] Add `theme` command for DDEV Add a custom `theme` command to DDEV which provides helpers such as `ddev theme development`, `ddev theme production`, and `ddev theme watch` for building the front-end assets, and `ddev theme ssh` to easily SSH into the theme directory inside web container. --- .ddev/commands/host/theme | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 .ddev/commands/host/theme diff --git a/.ddev/commands/host/theme b/.ddev/commands/host/theme new file mode 100755 index 0000000..beb1bed --- /dev/null +++ b/.ddev/commands/host/theme @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +## Description: Helper commands for the for theme +## Usage: theme development|install|production|ssh|watch + +set -e + +THEME_PATH="/var/www/html/$DDEV_DOCROOT/themes/custom/opdavies" + +case $1 in + dev|development) + ddev theme install + ddev exec -d $THEME_PATH npm run development + ;; + + install) + ddev exec -d $THEME_PATH npm ci + ;; + + prod|production) + ddev theme install + ddev exec -d $THEME_PATH npm run production + ;; + + ssh) + ddev ssh -d $THEME_PATH + ;; + + watch) + ddev theme install + ddev exec -d $THEME_PATH npm run watch + ;; + + *) + echo "Invalid argument: $1" + ;; +esac