themes-wordpress/package-dotorg.sh

22 lines
No EOL
950 B
Bash
Executable file

#!/bin/zsh
if [[ "$1" != "" ]]; then
THEME="$1"
find $THEME/assets/sass/*.scss -type f -exec sed -i '' 's/-wpcom//g' {} \;
find $THEME/assets/sass/*.scss -type f -exec sed -i '' 's/, auto-loading-homepage//g' {} \;
find $THEME/assets/sass/*.scss -type f -exec sed -i '' 's/, jetpack-global-styles//g' {} \;
find $THEME/style.css -type f -exec sed -i '' 's/-wpcom//g' {} \;
find $THEME/style.css -type f -exec sed -i '' 's/, auto-loading-homepage//g' {} \;
find $THEME/style.css -type f -exec sed -i '' 's/, jetpack-global-styles//g' {} \;
cd $THEME && npm run build;
mkdir $THEME;
rsync -avz --include='theme.json' --exclude $THEME --exclude-from '../dotorg-exclude.txt' ./ $THEME
find $THEME -type f -name '*.map' -delete # for some reason rsync won't exclude map files
rm -rf $THEME/$THEME
zip -r -X $THEME.zip $THEME
rm -rf $THEME
git restore ./
else
echo "Please provide the theme slug as an argument to the script."
fi