Last active
September 20, 2018 13:16
-
-
Save kemsakurai/9487304b1fb9ed9447fbd8a897c45cc0 to your computer and use it in GitHub Desktop.
サイトの全てのHTML に uncss cssbeautify-cli を実行するスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOMAIN='www.yourdomain.com' | |
# toppageから、category page、archivepage のcache を作成 | |
wget -q https://$DOMAIN --no-cache -O - | egrep -o "/blog/category/[^\"]+|/blog/archive/[^\"]+|/about[^\"]+|/blog/feeds/[^\"]+" | sed "s/'/'/g" | sort | uniq | while read line; | |
do | |
filename=$(echo "$line"| sed 's/\///g') | |
# loadCSS を使用している影響でcss が読み込めなかったので、uncss 対象のcss を直接指定 | |
echo 'uncss '"https://$DOMAIN""'""$line""'"' -t 5000 -s https://$DOMAIN/static/CACHE/css/690a0d57c104.css | cssbeautify-cli -s > '"'""$filename"".css'" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOMAIN='www.yourdomain.com' | |
wget -q https://$DOMAIN/sitemap.xml --no-cache -O - | egrep -o "https://$DOMAIN[^<]+" | sed "s/'/'/g" | while read line; | |
do | |
filename=$(echo "$line"| sed 's/\///g') | |
# loadCSS を使用している影響でcss が読み込めなかったので、uncss 対象のcss を直接指定 | |
echo 'uncss '"'""$line""'"' -t 5000 -s https://$DOMAIN/static/CACHE/css/690a0d57c104.css | cssbeautify-cli -s > '"'""$filename"".css'" >> css | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment