User login

Building a Zen sub-theme: In shell commands

From the Zen documentation How to build your own sub-theme (6.x), translated into bash commands. The project is called example, and we have installed the zen theme to sites/default/themes.

Someone enterprising could make this into a simple bash script.

UPDATE: Someone did turn this into a bash script that was later incorporated into the docs. Here is a modified version of a more robust script that was posted to Jason Chinn's Magicsparks site:

zen_subtheme.sh (Zipped, as shell files cannot be accessed in Drupal's files directory!)

Run it from the root of your Drupal directory after making sure Zen 1.0 is in your sites/all/themes directory (drush dl zen will do that).

The command (substitute your new theme folder name, fixed for liquid if you want, theme title and description) is:

zen_subtheme.sh newthemename liquid "New theme title" "New theme description."

If you insist on doing it by hand, the commands to make it easy:

<code>
cd /sites/example/www/sites/default/themes
sudo cp -pr zen/STARTERKIT/ example_zen
cd example_zen/
sudo mv STARTERKIT.info example_zen.info
sudo vi example_zen.info

All right, the editing of the .info file will be hard to script. But all the rest should definitely be scriptified.

We're still in /sites/scfabout/www/sites/default/themes/example_zen and the Zen system of themes is next door.

Because fixed-width layout is evil we go straight for flexible (or as it's called here, liquid). Urgh, maybe on this project I should be using fixed with. OK, make this a variable in the script! Alternate line is cp -p ../zen/zen/layout-fixed.css layout.css

sudo cp -p ../zen/zen/layout-liquid.css layout.css
sudo cp -p ../zen/zen/print.css print.css
sudo cp -p ../zen/zen/zen.css example_zen.css

Then the next steps of editing template.php and theme-settings.php to replace "STARTERKIT" with your theme name ("example_zen" in this case) could be scripted also.

Resolution

Searched words: 
bash shell terminal command line make a Zen subtheme sub Zen theme for Drupal via command line

Comments

Here's an experiment with getting the initial Zen from CVS

Using the latest in the Drupal-5 branch, with the idea that we'd be able to update it to a stable version later:


cd www/sites/default/
sudo mkdir themes
cd themes
sudo cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-5 -d zen contributions/themes/zen

What's this comment about Drupal 5 for?

Seems off-topic and points to a potentially dangerous mental instability on the part of the poster.

sed grep rename to build from zen starterkit

Has this work developed further by now? I imagine a little sed could assist in a script to make it a single command flow..

zenophile exists for automating zen subtheme creation

Oops. Here's what I get for commenting on a 2yr old post ;) Let me cover my tracks a bit for future wanderers:
http://drupal.org/project/zenophile

Zenophile allows themers to very easily create Zen subthemes without all the tedious file copying and find-and-replacing required when creating subthemes by hand. It also simplifies other common tasks when creating Zen subthemes, such as adjusting the width and placement of sidebars. Zenophile includes a simple API allowing developers to create their own modules to modify Zenophile's behavior and add their own features. And it even supports Drush for you CLI fans out there.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.