我一直在使用这种方法来使用版本化的归档进行私有主题更新,它似乎对我很有用。尚未发现问题。所以我想对于私人主题来说,这是一个很好的主题。
此外,我还提出了一个构建版本化主题归档的脚本,如下所示:
#!/bin/bash
echo "======================";
echo "BUILDING THEME ARCHIVE";
echo "======================";
# Get version from style.css and CHANGES.md and compare them.
# If they are the same - proceed.
VER_STYLE="$(cat style.css | grep \'Version: \' | perl -pe "s/Version: (.*)\\\\n/\\1/g")"
VER_CHANGES="$(head -n 1 CHANGES.md | xargs | awk \'{ print $2 }\')"
if [ $VER_STYLE != $VER_CHANGES ]; then
printf "\\e[31;5;21m%s\\e[0m\\n" "BUILD FAILED"
echo "Your version in style.css ($VER_STYLE) differs from version in CHANGES.md ($VER_CHANGES).";
echo "Please actualize.";
exit 1;
fi
# Theme archive build.
# Also create a new tag for builded version.
build_name="my-theme_$VER_STYLE.zip"
echo "Building $build_name ...";
zip -r -q \\
--exclude=.* \\
--exclude=sass/* \\
--exclude=*/.DS_Store \\
--exclude=*.md \\
--exclude=*.zip \\
--exclude=*.sh \\
$build_name . && git tag $VER_STYLE && git push --tags && printf "\\e[32;5;21m%s\\e[0m\\n" "done" ;
exit 0;