To generate a new theme named "my_new_theme" in Drupal, you can use the following command from the Drupal root directory: Ex:- C:\wamp64\www\d10\web
php core/scripts/drupal generate-theme my_new_theme
This will create the new theme in the themes directory by default. You can use the --help flag to view all configuration options for the generate-theme command:
php core/scripts/drupal generate-theme --help
You can also use a custom starterkit theme as a starting point for your new theme. To use a theme called "source_theme_name" as a starterkit, you will need to add a line containing starterkit: true to the source_theme_name.info.yml file, and make any necessary design decisions (such as default markup and CSS).
Then, you can generate a new theme using the starterkit theme with the following command:
php core/scripts/drupal generate-theme --starterkit source_theme_name my_new_theme
The source_theme_name theme can also include a \Drupal\source_theme_name\StarterKit class that implements the \Drupal\Core\Theme\StarterKitInterface interface, which can perform additional post-processing on the generated theme. You can refer to the core Starterkit theme for an example of this implementation.
Comments