15 lines
370 B
Bash
Executable File
15 lines
370 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
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
|