Add drush command for generating subtheme

Created on 6 June 2021, over 3 years ago
Updated 5 April 2024, 8 months ago

Number of issues related to SCSS generation

  • Move subtheme code to class
  • Add drush command to create subtheme
✨ Feature request
Status

Fixed

Version

3.0

Component

Code

Created by

🇦🇺Australia VladimirAus Brisbane, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇺🇦Ukraine abyss

    Hi @VladimirAus, I added a command for drush that allows you to generate subthemes with it.
    Also, please add to the documentation an example of how to call this command from console.
    drush --include="web/themes/contrib/bootstrap5" bootstrap5:subtheme

  • 🇮🇳India ravi kant Jaipur

    Not sure what is requirement of drush command because An option is available in theme for generate theme.
    1. Navigate to /admin/appearance/settings/bootstrap5
    2. Fill Subtheme location, Subtheme name and Subtheme machine name in the theme subtheme section and create.

    This is generating a subtheme very easily and without error.

  • Status changed to Needs work over 1 year ago
  • 🇦🇺Australia VladimirAus Brisbane, Australia

    Thanks @Abyss. Good start, but command is not visible. I found few issues:

    • Commands folder should be under src. Seeother modules as an example.
    • Use dependency injection instead of \Drupal::.... See full phpcs log below.
    • Update README.

    phpcs log

    FILE: /Users/tesboss/_PROJECTS/drupal/bootstrap5/Commands/bootstrap5/SubthemeCommands.php
    ---------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------
     45 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     45 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------
    
    
  • Status changed to Needs review about 1 year ago
  • 🇺🇦Ukraine abyss

    @VladimirAus, sorry for the long answer.
    In this case, we can't add dependency injection as there is a problem with it in Drupal at the moment.
    Also, it doesn't make sense for us to move Commands under src, since we use autoloader to load the drush command.
    You can find more detailed information here:
    https://kporras07.com/blog/creating-drush-commands-inside-theme
    https://github.com/drush-ops/drush/issues/4685

    Also updated the description in README.md.

  • 🇨🇦Canada optasy

    I tested this and I was able to create the B5 Subtheme, I had to run this command for that

    drush --include="web/themes/contrib/bootstrap5" bootstrap5:subtheme --subtheme-name="B5 subtheme"

    Sadly, the drush B5 command is not available if I don't use the --include option, and I had to clear cache because the new subtheme wasn't available at /admin/appearance right after I ran the drush command.

  • 🇺🇦Ukraine abyss

    @OPTASY, could you please describe this problem in more detail?
    I made a sub theme with the command and without any additional movements after reloading the theme list page, I can see it.

  • Status changed to RTBC 12 months ago
  • Status changed to Needs work 8 months ago
  • 🇦🇺Australia VladimirAus Brisbane, Australia

    Structure is not according to Drupal standard:

    • Commands should be moved to src folder from Commands/bootstrap5/SubthemeCommands.php to src/Commands/SubthemeCommands.php
    • namespace should be Drupal\bootstrap5\Commands instead of namespace Drush\Commands\Commands;
  • 🇦🇺Australia VladimirAus Brisbane, Australia

    VladimirAus → changed the visibility of the branch 3.0.x to hidden.

  • Status changed to Needs review 8 months ago
  • 🇦🇺Australia VladimirAus Brisbane, Australia

    Based on this Drush issue and Drush command generator I update the branch.

  • Status changed to RTBC 8 months ago
  • 🇦🇺Australia jannakha Brisbane!

    thanks for the patch

  • Pipeline finished with Skipped
    8 months ago
    #125694
  • Status changed to Fixed 8 months ago
  • 🇦🇺Australia VladimirAus Brisbane, Australia
  • 🇦🇺Australia VladimirAus Brisbane, Australia

    Merged! Thank you 🥂

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024