- Issue created by @etxaleku
- πΊπΈUnited States etxaleku
Hmm, it looks like there are multiple automated ways to generate a subtheme.
Option 1 -
php web/core/scripts/drupal generate-theme my_theme --starterkit=bootstrap5
Option 2 -
drush --include="web/themes/contrib/bootstrap5/src/Drush" bootstrap5:generate-subtheme my_theme --subtheme-name="My Theme"
Option 1 works in Drupal 11.1.2 (after manually creating bootstrap5.starterkit.yml) while Option 2 fails with this stacktrace -
Error: Class "Drupal\bootstrap5\SubthemeManager" not found in /var/www/html/web/themes/contrib/bootstrap5/src/Drush/Commands/Bootstrap5Commands.php on line 67 #0 [internal function]: Drush\Commands\Bootstrap5Commands->generateSubtheme() #1 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array() #2 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() #3 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() #4 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process() #5 /var/www/html/vendor/symfony/console/Command/Command.php(279): Consolidation\AnnotatedCommand\AnnotatedCommand->execute() #6 /var/www/html/vendor/symfony/console/Application.php(1094): Symfony\Component\Console\Command\Command->run() #7 /var/www/html/vendor/symfony/console/Application.php(342): Symfony\Component\Console\Application->doRunCommand() #8 /var/www/html/vendor/symfony/console/Application.php(193): Symfony\Component\Console\Application->doRun() #9 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run() #10 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun() #11 /var/www/html/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run() #12 /var/www/html/vendor/bin/drush.php(119): include('...') #13 {main} Error: Class "Drupal\bootstrap5\SubthemeManager" not found in Drush\Commands\Bootstrap5Commands->generateSubtheme() (line 67 of /var/www/html/web/themes/contrib/bootstrap5/src/Drush/Commands/Bootstrap5Commands.php). [warning] Drush command terminated abnormally.
- π¬π§United Kingdom rossb89 Bristol
The README.md has the wrong command name in I think.
The readme states this:
drush --include="web/themes/contrib/bootstrap5/src/Drush" bootstrap5:subtheme MACHINE_NAME --subtheme-name="SUBTHEME_NAME"
When it should be this:
drush --include="web/themes/contrib/bootstrap5/src/Drush" bootstrap5:generate-subtheme MACHINE_NAME --subtheme-name="SUBTHEME_NAME"
And make sure the base theme is enabled to start with or you'll get this error:
Error: Class "Drupal\bootstrap5\SubthemeManager" not found in Drush\Commands\Bootstrap5Commands->generateSubtheme()
After enabling the theme and running the correct Drush command, it does work and generate the sub theme.