2024-11-13 12:06:30 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-11-15 22:21:18 +00:00
|
|
|
|
|
|
|
prev_mtime=$(cat styles.mtime)
|
|
|
|
curr_mtime=$(stat -c %Y css/styles.css)
|
|
|
|
|
|
|
|
##has styles.css been modified?
|
|
|
|
if [[ $prev_mtime != "$curr_mtime" ]]; then
|
|
|
|
##update .mtimes
|
|
|
|
sed -i "1s/.*/$curr_mtime/" styles.mtime
|
|
|
|
echo "file has been modified!"
|
|
|
|
##insert the commit id
|
|
|
|
COMMIT="$(git rev-parse HEAD)"
|
|
|
|
sed -i "s/css?=\w*/css?v=${COMMIT}/g" index.html
|
|
|
|
fi
|