10 09/2014

hexo quick publish

最后更新: Wed Sep 10 2014 12:37:50 GMT+0800

For some reason,I can not use hexo deploy for my site.I used to shell like this

hexo generate
cd public
git add .
git commit . -m 1111
git push

So boring!So i would like to shortcut this writing to a shell file - g

hexo/tt4 is my hexo project folder!

cd ~/hexo/tt4

vim g

paste the content below

#!/bin/bash          

START=$(date +%s)
hexo generate

uglifycss ./public/css/style.css > ./public/css/s.css
mv ./public/css/s.css ./public/css/style.css

cd ./public

now=$(date +"%Y-%m-%d %H:%M")
git add .
git commit . -m "$now"
git push

END=$(date +%s)
DIFF=$(( $END - $START ))
echo "发布完毕!用了 $DIFF 秒"           

chmod +x g

Everytime i want to pulish.just type in Terminal

./g


I also make hexo server -generate to s file.Everytime i want local sever just type

./s

BTW : Maybe you also want to know something about github cli