From aadf941df72d7af006e8af53470500beec897c95 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Oct 2022 13:34:50 +0400 Subject: [PATCH] Gitignore, "selfhosted" menu section --- .gitignore | 2 ++ build.sh | 21 +++++++++++++++----- index.html | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ styles.less | 46 ++++++++++++++++++++++++++++-------------- 4 files changed, 106 insertions(+), 20 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e5de46 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +dist/ +.vscode/ diff --git a/build.sh b/build.sh index 865c891..1d42558 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,7 @@ RED='\033[1;31m' GREEN='\033[1;32m' YELLOW='\033[1;33m' BLUE='\033[1;34m' +BOLD='\033[1m' RESET='\033[0m' minjs="dist/script.min.js" @@ -19,9 +20,15 @@ title() { echo -e "${BLUE}[*]${RESET} $1" } +start() { + echo + echo -e "${YELLOW}[+]${RESET} ${BOLD}Building web site in:${RESET}" + echo -e "${BOLD}$PWD${RESET}" +} + success() { echo - echo -e "${GREEN}[V]${RESET} Done" + echo -e "${GREEN}[V]${RESET} ${BOLD}Done${RESET}" echo } @@ -46,7 +53,6 @@ html_minify () { --collapse-whitespace \ --remove-attribute-quotes \ --remove-comments \ - --remove-optional-tags \ --remove-script-type-attributes \ --remove-style-link-type-attributes \ --use-short-doctype \ @@ -61,6 +67,11 @@ copy_files() { find -maxdepth 1 -exec bash -c "if [[ {} =~ $regex ]]; then :; else cp -r {} dist/; fi" \; } +start + +title "Creating dist/" +mkdir -p dist/ + title "Checking dependencies" check_deps terser check_deps lessc @@ -68,8 +79,6 @@ check_deps cleancss check_deps html-minifier check_deps python3 -mkdir dist/ - title "Minifying JS" js_minify @@ -79,8 +88,10 @@ lessc "styles.less" "$mincss" title "Minifying CSS" cleancss -o "$mincss" "$mincss" -title "Minifying HTML" +title "Editing HTML" cat index.html | python3 html_conv.py "$minjs_name" "$mincss_name" >"$minhtml" + +title "Minifying HTML" html_minify "$minhtml" title "Copying other files" diff --git a/index.html b/index.html index 8267bb8..f84d202 100644 --- a/index.html +++ b/index.html @@ -47,6 +47,7 @@ +