Skip to content

Instantly share code, notes, and snippets.

@starsinmypockets
Created March 15, 2013 20:31
Show Gist options
  • Select an option

  • Save starsinmypockets/5172904 to your computer and use it in GitHub Desktop.

Select an option

Save starsinmypockets/5172904 to your computer and use it in GitHub Desktop.
Shell script to initialize theme for drupal 7
#!/bin/bash
function show_usage {
echo "Usage: $0 theme_name"
exit 1
}
if [ $# -ne 1 ]; then
show_usage
fi
THEMEDIRECTORY=sites/all/themes/$1
mkdir $THEMEDIRECTORY
mkdir $THEMEDIRECTORY/css
mkdir $THEMEDIRECTORY/js
mkdir $THEMEDIRECTORY/images
mkdir $THEMEDIRECTORY/templates
chmod -R 755 $THEMEDIRECTORY
touch $THEMEDIRECTORY/$1.info
touch $THEMEDIRECTORY/template.php
touch $THEMEDIRECTORY/js/script.js
touch $THEMEDIRECTORY/css/style.css
cp modules/block/block.tpl.php $THEMEDIRECTORY/templates/
cp modules/system/html.tpl.php $THEMEDIRECTORY/templates/
cp modules/system/page.tpl.php $THEMEDIRECTORY/templates/
cp modules/node/node.tpl.php $THEMEDIRECTORY/templates/
cp modules/search/search-block-form.tpl.php $THEMEDIRECTORY/templates/
echo "name = $1
description = A Custom theme for $1
version = 1
core = 7.x
stylesheets[all][] = css/layout.css
scripts[] = js/script.js
regions[header] = Header
regions[carousel] = Carousel
regions[sub_navigation] = Sub Navigation
regions[left] = Left
regions[middle] = Middle
regions[right] = Right
regions[footer] = Footer
regions[content] = Content" > $THEMEDIRECTORY/$1.info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment