update build script
This commit is contained in:
parent
1f489866a6
commit
9ada4948cb
11
README.md
11
README.md
@ -1,6 +1,13 @@
|
|||||||
YTCget
|
YTCget — Show YouTube video cover
|
||||||
------
|
=================================
|
||||||
![Preview](preview.png)
|
![Preview](preview.png)
|
||||||
|
|
||||||
**Thanks:**
|
**Thanks:**
|
||||||
+ @takien: for [youtubeID.js](https://gist.github.com/takien/4077195) script.
|
+ @takien: for [youtubeID.js](https://gist.github.com/takien/4077195) script.
|
||||||
|
|
||||||
|
Build
|
||||||
|
-----
|
||||||
|
|
||||||
|
**Requirements:**
|
||||||
|
|
||||||
|
* [minify-html](https://github.com/wilsonzlin/minify-html/)
|
||||||
|
44
make_dist.sh
44
make_dist.sh
@ -1,34 +1,34 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
echo -e "Making \033[0;31mYTCget\033[0m dist..."
|
echo -e "Making \033[0;31mYTCget\033[0m dist..."
|
||||||
|
|
||||||
if [ -d "./dist" ]; then
|
if [ ! -d "./dist" ]; then
|
||||||
echo -en "Cleaning \033[0;31m./dist/\033[0m directory..."
|
echo -e "Make \033[0;31m./dist/\033[0m directory."
|
||||||
rm -rf "./dist/*"
|
mkdir "./dist/"
|
||||||
echo " Complete!"
|
fi
|
||||||
|
|
||||||
echo -n "Copying static files..."
|
echo -en "Cleaning \033[0;31m./dist/\033[0m directory..."
|
||||||
cp ./src/youtubeID.js ./dist/youtubeID.js
|
rm -rf "./dist/*"
|
||||||
cp ./src/ytcg.js ./dist/ytcg.js
|
echo " Complete!"
|
||||||
echo " Complete!"
|
|
||||||
|
|
||||||
echo -n "Minifying files..."
|
echo -n "Copying static files..."
|
||||||
minify-html ./src/styles.css -o ./dist/styles.css
|
cp ./src/youtubeID.js ./dist/youtubeID.js
|
||||||
minify-html \
|
cp ./src/ytcg.js ./dist/ytcg.js
|
||||||
|
echo " Complete!"
|
||||||
|
|
||||||
|
echo -n "Minifying files..."
|
||||||
|
minify-html ./src/styles.css -o ./dist/styles.css
|
||||||
|
minify-html \
|
||||||
--do-not-minify-doctype \
|
--do-not-minify-doctype \
|
||||||
--keep-closing-tags \
|
--keep-closing-tags \
|
||||||
--keep-spaces-between-attributes \
|
--keep-spaces-between-attributes \
|
||||||
--keep-html-and-head-opening-tags \
|
--keep-html-and-head-opening-tags \
|
||||||
./src/index.html -o ./dist/index.html
|
./src/index.html -o ./dist/index.html
|
||||||
|
|
||||||
GIT_COMMIT_HASH=$(git rev-parse --short HEAD)
|
GIT_COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||||
sed -i -- "s/{GIT_COMMIT_HASH}/$GIT_COMMIT_HASH/g" ./dist/index.html
|
sed -i -- "s/{GIT_COMMIT_HASH}/$GIT_COMMIT_HASH/g" ./dist/index.html
|
||||||
echo " Complete!"
|
echo " Complete!"
|
||||||
|
|
||||||
echo -en "Making \033[0;31mytcg-$GIT_COMMIT_HASH.tar.xz\033[0m file..."
|
echo -en "Making \033[0;31mytcg-$GIT_COMMIT_HASH.tar.xz\033[0m file..."
|
||||||
tar -cJf "ytcg-$GIT_COMMIT_HASH.tar.xz" ./dist/*
|
tar -cJf "ytcg-$GIT_COMMIT_HASH.tar.xz" ./dist/*
|
||||||
echo " Complete!"
|
echo " Complete!"
|
||||||
else
|
|
||||||
echo -e "Make \033[0;31m./dist/\033[0m directory."
|
|
||||||
mkdir "./dist/"
|
|
||||||
fi
|
|
||||||
|
Loading…
Reference in New Issue
Block a user