The subTheme drush command is currently not picked up by Drush 9. The blog post by Moshe Weitzman describes basic steps for porting existing command.
https://weitzman.github.io/blog/port-to-drush9
I have tried to follow the blog post but so far i have been unable to get this working. If i succeed i will provide a patch.
Adding Drush 9 support should not break backward compatibility as the original drush.inc file can co-exist.
Update
The latest patch should make the commands available in Drush 9. The current beta8 version of Drush 9 does not handle drush commands for themes, only for modules. There is a patch available for drush here: https://patch-diff.githubusercontent.com/raw/drush-ops/drush/pull/3089.p...
Comment | File | Size | Author |
---|---|---|---|
#33 | 2920472-subtheme-33.patch | 2.73 KB | mlncn |
#8 | add_support_for_drush9-2920472-8.patch | 6.63 KB | ericmulder1980 |
Comments
Comment #2
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commentedSo it seems this isn't supported yet : https://github.com/drush-ops/drush/pull/3089
Comment #3
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commentedYou need the following patch for drush to make this work: https://patch-diff.githubusercontent.com/raw/drush-ops/drush/pull/3089.p...
I am currently working on the patch for zurb_foundation command file. Will provide this in a moment.
Comment #4
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commentedComment #5
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commentedComment #6
HongPong CreditAttribution: HongPong as a volunteer and at kor group commentedwow ericmulder1980 thank you for figuring this out. That's so nifty. Does it get any conflicts with Drush 8 when these are applied?
Comment #7
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commentedcurrently still working on this. The supplied patch has errors. I will upload en updated version tomorrow.
@HongPong: Yes you will be able to use this alongside the Drush 8 implementation. Drush 8 uses the inc/zurb_foundation.drush.inc file and Drush 9 uses the ZurbFoundationsCommands class. As of Drush 9 it will no longer pick up the old drush.inc file so porting this has some urgency as of Drupal 8.4 Drush 8 is no longer supported.
Comment #8
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commentedThis new patch should do the trick. One problem remains, the theme is not enabled after creation. Probably has something to do with clearing theme or generic cache but i havent found the solution.
Comment #9
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commentedComment #10
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commentedComment #11
serg2 CreditAttribution: serg2 commentedCan review and test one the updated patch gets posted.
Comment #12
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commented@serg2 : add_support_for_drush9-2920472-8.patch is the updated patch.
Comment #13
serg2 CreditAttribution: serg2 commentedoh, sorry I cross posted (tabbed out reading Moshe's guide). Will test it now.
Comment #14
serg2 CreditAttribution: serg2 commentedWith Drupal version: 8.4.1, Drush version: 8.1.15 you can still use drush fst and it runs from the unchanged drush.inc. It is unchanged so that is all good.
Once Drush version: 9.0.0-beta8 is installed i get problems. Running drush fst gives a symphony error "Command "fst" is not defined". Running drush list does not show the command. I also checked with console.
It is 100% possible it is a composer issue on my setup so would suggest that someone else reviews.
Comment #15
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commented@serg did you install the patch for drush i mentioned in the OP?
Comment #16
serg2 CreditAttribution: serg2 commentedNope!I will swing back round to this tonight.
Comment #17
serg2 CreditAttribution: serg2 commentedOkay, tested again, this time after applying the patch in the IS.
There is a slight difference in the functionality:
The command for Drush 8 was:
drush fst SubThemeName
For Drush 9 a machine name is required:
drush fst SubThemeName SubThemeMachineName
Once the subtheme has been successfully generated an error is reported:
[error] Unknown themes: new.
This has been an existing issue with Drush 8 also so not a deal breaker.
Because this patch requires a Drush patch we shouldn't commit it. Drush version : 9.0.0-beta8 is a final beta so I am not sure that they will make the changes to allow themes to register commands.
@ericmulder1980 do you want to inform the drush team over at https://github.com/drush-ops/drush/pull/3089 ?
I would say that is the most important thing, the clean up & adding cache clear can come after.
Comment #18
ericmulder1980 CreditAttribution: ericmulder1980 as a volunteer commented@serg2 i asked for an ETA update at Drush issue queue. I don't think merging this to develop would hurt anyone as drush 8 is currently still supported. Everyone using Drupal 8.4.x and higher will be 'forced' to Drush 9 and come across this issue.
Comment #19
serg2 CreditAttribution: serg2 commentedNot sure, I would say that we should wait on the response from the Drush team. If they indicate the inclusion of the #3089 patch in upcoming releases then we could preemptively commit this.
Comment #20
HongPong CreditAttribution: HongPong as a volunteer and at kor group commentedI agree w serg2 that we need to wait until drush team commit to the overall shape of the PR because if they tweak the API a little bit then we would be unleashing a flawed drush 9 implementation.
The good news is that they did patch drush 8 branch to work with 8.4.x I inquired with some people this weekend and we are in the clear there.
If anyone has drush 8 issues please make sure you update to at least 8.1.15: https://github.com/drush-ops/drush/releases/tag/8.1.15
Comment #21
nco71 CreditAttribution: nco71 commentedHi I have a beginner question there , I wish to use your patched drush 9 config for another drupal theme ( emulsify ) which has similar issue.
I saw this patch concern fundation 8.x-6.0-alpha3 but I couldn't find the specific commit ID and therefore couldn't find the original files to patch. Could somebody point me to the right direction ?
Finally found the solution , git clone https://www.drupal.org/node/1332338/git-instructions/8.x-6.x/nonmaintainer apply patch it with git apply -v, also I didn t see both file where at the root of the project.
Comment #22
leymannxLet's postpone this issue until the underlying core issue got fixed.
Comment #23
fgmThe underlying issue is "won't fix", so drush 9 commands for the theme won't be available.
The recommended alternative is to make the theme depend on a module in #474684: Allow themes to declare dependencies on modules which seems likely to appear with Drupal 8.6.
Alternatively, I've seen mentions of some themes using Drupal console instead to work around the problem.
Comment #24
leymannxComment #25
leymannxWhich means we could actually start working on a zurb_companion module and then declare it as dependency as soon as the new underlying core issue got fixed.
Comment #26
HongPong CreditAttribution: HongPong as a volunteer and at kor group commentedRevisiting this. Should we make a zurb helper module and put the drush commands in there?
Comment #27
asrobHi,
I've just created a new zurb_foundation_companion module to work with drush 9 / 10.
It's not stable yet, there are a few missing functions but it works. Co-maintainers are welcome. :)
Comment #28
frobNot sure why we need yet another helper module we already have #3025313: Outsource foundation libraries into common module dependency? and the foundation_sites module. This should be pushed into a separate initiative where we discuss the common functionality and break that out.
I am thinking the functionality that is broken out is:
Thoughts?
Comment #29
leymannxWe need Drush 10 support. Drupal Console is basically dead. The companion module should be merged into the foundation_sites module.
Comment #30
kclarkson CreditAttribution: kclarkson at Blend Me, Inc commentedHere is the error message I am receiving after installation.
Comment #31
andy-blumCame across this issue looking for a solution for UIKit's subtheme initialization. It seems like themes defining drush tasks is just not going to happen, so I made a composer script to do the task instead. Hope this helps!
Comment #32
leymannxUh, wow! This is a good idea 👍
Comment #33
mlncn CreditAttribution: mlncn at Agaric for Drutopia commentedHere is a patch for the composer script approach.
Comment #34
mlncn CreditAttribution: mlncn at Agaric for Drutopia commentedBut realizing i think this whole approach should be obsolete now? #3364885: Allow themes to use a starterkit.yml file so it is easier to use the theme generator
Starterkit themes now use starterkit.yml file
Blog post: https://mglaman.dev/blog/improving-drupal-theme-starterkit-and-theme-gen...