Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 33 lines (24 sloc) 1.02 KB
#!/usr/bin/env bash
# shell script hardening
set -euo pipefail
# This script creates a new sub them from the zen base theme.
# (Run chmod 700 on this file to make it executable)
if [[ ! -d "zen" || "${PWD##*/}" != "themes" ]]; then
echo "Error: This script must be run from the theme folder."
echo "Usage: ./zen/"
if [[ -z "${1-}" ]]; then
echo -n "Enter a human-readable subtheme name: "
read -e inputname
human=`echo $inputname | sed -e 's/"/\\"/g'`
themename=`echo $inputname | tr [:upper:] [:lower:] | sed -e 's/[\-\ ]/_/g' -e 's/[^a-z0-9_]//g'`
mkdir "$themename"
cp -p zen/.eslintrc zen/.gitignore zen/.sass-lint.yml $themename/
cp -p zen/gulpfile.js zen/package-lock.json zen/package.json zen/theme.toml $themename/
cp -pr zen/assets $themename/
cp -pr zen/static $themename/
sed -e 's/^\(name = \).*$/\1"'"$human"'"/g' -e 's/^\(description = \).*$/\1"A Zen sub-theme"/g' $themename/theme.toml > $themename/theme.toml.temp
mv -f $themename/theme.toml.temp $themename/theme.toml
You can’t perform that action at this time.