Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Since Drush usage seems to be spreading in the design/themer community, it might be useful to have drush support for building sub-themes and choosing layout files.
Comment | File | Size | Author |
---|---|---|---|
#5 | zen.drush_.inc_.txt | 2.75 KB | marcvangend |
#3 | zen--drush.1.patch | 3.06 KB | jix_ |
Comments
Comment #1
seutje CreditAttribution: seutje commentedyes, this would be awesome
Ink Ribbon already does this, might draw some inspiration from that
Comment #2
jix_ CreditAttribution: jix_ commentedI've made a Drush command lately for my own Zen starter kit, although it's very basic at the moment. (It only copies the starter kit and renames things where applicable.)
If something like this gets into Zen, it would be really awesome if, somehow, one could use that single command for their own starter kit as well. Something like
drush zen "My theme name" --kit=cassette
That way I wouldn't have to create a silly fake theme just to be able to execute that command for my own starter kit, for example.
I'll make a patch from my command so it works for Zen, maybe from there we could start improving and extending it.
Comment #3
jix_ CreditAttribution: jix_ commentedFirst stab
Comment #4
marcvangendsubscribe. this would be awesome.
Comment #5
marcvangendI gave it a quick try tonight. At first I got a 'deprecated' error because you used the split() function on line 37 (I'm using php 5.3). I changed split() to explode() to fix the bug, and join() to implode() because it seems more consistent. I'm attaching the changed file as .txt. After that, my sub theme was created and so far everything looks fine.
Comment #6
sirkitree CreditAttribution: sirkitree commentedwhere does this file belong?
Comment #7
marcvangend@sirkitree:
From the Drush readme.txt:
Comment #8
sirkitree CreditAttribution: sirkitree commented:)
Yes. I placed this in my ~/.drush folder for it to work, but only after trying to run the patch in the theme directory, effectively creating a zen.drush.inc file within /sites/all/themes/zen/ - which will not work. Since (IMHO) it's a little bit different for a theme to provide a drush.inc file and it doesn't seem to work when you do, we should have it documented somewhere within this theme as to where to place it so that when this file ships with the theme it's known that you have to actually move it.
Or am I missing something and it's actually supposed to work when you have the file within your theme? I tried Drush 3.3 and 4.1 with the file in the theme folder and neither picked it up.
Otherwise, works as advertised :)
Comment #9
Chris CharltonThe `zenophile` module already offers this capability. http://drupal.org/project/zenophile
Comment #10
JohnAlbinOk. I got the sub-theme creation drush command working. http://drupalcode.org/project/zen.git/commit/866610f
To make this really work though, we'll need to get this patch into Drush 4.5: #535788: Check sites/all/themes for *.drush.inc files
Comment #11
marcvangendExcellent, thanks John!
(Makes me wonder if there are more Zen features we could/should support in Drush. Maybe toggling the zen_rebuild_registry and zen_wireframes settings? If anyone is interested: start a new issue for it.)
Comment #14
KrisBulman CreditAttribution: KrisBulman commentedthis patch shows as it's been backported to 4.
what's the proper syntax to create a zen subtheme using drush?
Comment #15
marcvangend@KrisBulman:
Quote from the code:
Hope that helps.
Comment #16
KrisBulman CreditAttribution: KrisBulman commenteddrush 4.4
zen 7.x-3.x
zen/zen-internals/zen.drush.inc exists
copied the zen.drush.inc file to drush/includes/
same problem
Comment #17
KrisBulman CreditAttribution: KrisBulman commentedComment #18
KrisBulman CreditAttribution: KrisBulman commentedAfter reading the drush readme file, i created a .drush folder in my home folder and put the zen.drush.inc file in there and this functionality does work.
But considering post #10, shouldn't it just work without the above approach?
Comment #19
marcvangendKrisBulman: the patch mentioned in #10 was committed to the Drush-4.x branch in april, after Drush-4.4 was released. In other words, it should work with the latest dev version (http://drupal.org/node/1051250), not with 4.4.
Comment #20
KrisBulman CreditAttribution: KrisBulman commentedthanks for the update, worked like a charm
Comment #21
Sumeet.Pareek CreditAttribution: Sumeet.Pareek commentedThe zen command for drush failed on me with the below error
Digging into the zen.drush.inc file I notice the below line causing the error
So I realized that the command fails when you try to create a subtheme before you enable zen. Because without enabling zen theme drupal_get_path() return nothing for its path. I think this should either be fixed (by putting together the path without using drupal_get_path()) or there should be a mention in 'drush help zen' about the command working only when zen is enabled first. There might be very few like me who would try to create subtheme files before enabling zen, but doesn't it still sound like a good idea to make the changes.
Comment #22
jantoine CreditAttribution: jantoine commentedI ran into the same issue in #21. Thanks to @wikidkaka for documenting the problem!
Comment #23
AdrianB CreditAttribution: AdrianB commentedSame here, thanks wikidkaka @ #21. I hadn't enabled zen and got that error message.
Comment #24
Chris CharltonOne minor issue I saw recently was when I tried creating a Zen sub-theme via Drush where the theme name was empty. The files were generated but there wasn't any error checking to see if the theme name was empty before dumping files into my sites/all/themes folder.