I've installed

drush @TEST status | grep version
Drupal version : 7.19
Drush version : 6.0-dev

and latest zen,

drush @TEST pm-info zen | egrep "Version|Status"
Version : 7.x-5.1+93-dev
Status : enabled

If I subtheme zen, using an underscore in my subtheme name,

drush @TEST zen "test_zen"

the subtheme is create, but *incorrectly* with a hyphen replacing the underscore in the dir name,

Starter kit for "test_zen" created in: /dev/web/www.test.loc/sites/all/themes/test-zen
^^^^^^^^

Comments

makangus’s picture

Trying running drush @TEST zen "Test Zen" test_zen, the first argument is the theme name and the second optional argument is machine name.

JohnAlbin’s picture

Title: zen's drush subtheme creation incorrectly substitutes underscore ("_") with hyphen ("-") in given subtheme name » zen's drush subtheme creation uses hyphen instead of underscore in sub-theme directory name
Status: Active » Postponed (maintainer needs more info)

So the relavent line in zen.drush.inc is:

  $subtheme_path = implode('/', $subtheme_path) . '/' . str_replace('_', '-', $machine_name);

My thinking was that the path to assets like CSS, JS, images shouldn't use underscores. e.g. sites/all/themes/test-zen/images, sites/all/themes/test-zen/css, etc.

Note that the sub-theme works just fine. Even though the directory is named "test-zen", the .info file is test_zen.info and all the functions in template.php and theme-settings.php use "test_zen" in their names.

drupsup, is there a specific problem/bug this is causing? I'm open to discussing this.

drupsup’s picture

hi john, sorry for the delay ... i got caught up in abandoning all other themes on our sites, and migrating over to Zen.

to this issue -- no, no specific *bug*.

simply maintaining consistency & managing confusion.

as you've pointed out, currently,

cd /svr/www/www.mydomain.com/sites/all/themes
drush @test zen "test_zen5" test_zen5
ls -d test*
	test-zen5/

cd test-zen5/
grep -rlni test_zen5 .
	./template.php
	./test_zen5.info
	./theme-settings.php

for my own prefs,

  1. I typically expect that installers do what they're told -- where they're told to do it. overriding the owner's choices is, imo, simply bad mojo
  2. If, for whatever reason, I use path and file references in my site code, then having to manage TWO different name instances -- one with an underscore, and one with a hyphen, is just unccessary makework.
  3. I've had issues elsewere (admittedly, i'm hard pressed atm to even remember when/where/what ...) with hyphens in paths, which is why I switched everywhere/only in my envs to underscores.

bottom line -- give me an OPTION, and sure, I may be glad for it. FORCE me to "do what you think is best", and, eventually, one bumps into an issue.

my request? just let the drush installer do what I tell it to do.

similarly, open to discuss ...

thanks!

drupsup’s picture

Status: Postponed (maintainer needs more info) » Active
jwilson3’s picture

Is there a technical reason why paths to assets should be referenced with dashes in the URL?

Drupal core doesn't contain any folders with dashes in them.

Modules and themes that have spaces in their names stored on Drupal.org and downloaded with drush all get generated inside folders with underscores, to match the underscore in the module and theme name, and their respective assets are referenced using underscores in the URLs.

I guess the dash is technically not an invalid, but it just strikes me as odd, and have to agree with the arguments in #3.

drupsup’s picture

> Is there a technical reason why paths to assets should be referenced with dashes in the URL?'

If there is, then it's news to me ...

None of the other theme systems I've used have had any issues with underscores, or dashes for that matter.

The only argument I've found re: "dashes vs underscores" is SEO ... e.g.:

@ http://www.ecreativeim.com/blog/2011/03/seo-basics-hyphen-or-underscore-...

... you should use a hyphen for your SEO URLs. Google treats a hyphen as a word separator, but does not treat an underscore that way. Google treats and underscore as a word joiner — so red_sneakers is the same as redsneakers to Google. This has been confirmed directly by Google themselves, including the fact that using dashes over underscores will have a (minor) ranking benefit. ...

In general, if true, that *amplifies* the "leave it alone" argument made here ... it's up to ME to decide if I want Google et. al. ranking an asset at a given URL as "test_zen" or "test-zen" (which, 'in SEO' == "test" + "zen", apparently).

In Drupal, of course, my subtheme's dir isn't being exposed to search engines ...

*This* just sits in the 'annoyance' category.

JohnAlbin’s picture

Category: bug » task
Status: Active » Closed (works as designed)

I'm sorry this annoys you, but there's no bug here. Most people don't know that a theme can exist in a directory with dashes in it. It's only the .info file name that defines the machine name of the theme. And that file is created with the proper underscore.

Also, the Zen Classic theme lives at http://drupal.org/project/zen-classic without issue; it can be downloaded with drush using: drush dl zen-classic

JohnAlbin’s picture

Status: Closed (works as designed) » Active

Slept on this. The dash in the theme directory is inconsistent with other themes in the Drupal world. I shouldn't be trying to create a new standard with my drush commands. :-)

JohnAlbin’s picture

Status: Fixed » Closed (fixed)

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