pdssg

Pandoc static site generator
git clone https://git.torresjrjr.com/pdssg.git
Log | Files | Refs | README | LICENSE

commit 643416930ced9b240f147c34a8536d239405c311
parent 991dc5c58d39aa9a997e47052392a51af88b3718
Author: Byron Torres <b@torresjrjr.com>
Date:   Thu, 15 Jul 2021 03:27:16 +0100

Fix copying and minifier

Diffstat:
Mpdssg | 42+++++++++++++++++++-----------------------
1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/pdssg b/pdssg @@ -42,14 +42,13 @@ prepare_dst() { } echo "Copying from ./src/ to ./dst/" - cp -rv $( + copiable=$( find ./src/ \ - -newer ./src/.last_build \ + -maxdepth 1 \ -regex '\./src/[^.].*' \ - -maxdepth 1 - ) ./dst - cp ./src/_build.yml ./dst/.build.yml # builds.sr.ht - touch ./src/.last_build + -newer ./src/.last_build + ) + [ -n "$copiable" ] && cp -rv $copiable ./dst cd ./dst/ echo :: $(pwd) @@ -76,28 +75,25 @@ prepare_dst() { ASSETS_DIR="./ast" # No ending slash! echo "Finding CSS files in assets directory ${ASSETS_DIR}" - stylesheets=$(find ${ASSETS_DIR} -regex ".*/[^.]*\.css") + stylesheets=$( + find ${ASSETS_DIR} \ + -regex ".*/[^.]*\.css" \ + -newer ../src/.last_build \ + ) for stylesheet in ${stylesheets} do echo "Minifying ${stylesheet}" min_stylesheet="${stylesheet%.css}.min.css" - [ -f $min_stylesheet ] && continue - cp ${stylesheet} ${min_stylesheet} - vim ${min_stylesheet} -es --not-a-term +' - %s/\s*:\s*/:/ge - %s/\s*;\s*/;/ge - %s/\s*,\s*/,/ge - %s/\s*{\s*/{/ge - %s/\s*}\s*/}/ge - %s/\s*(\s*/(/ge - %s/\s*)\s*/)/ge - %s/^\s*//e - %s/\n//e - %s/\/\*.\{-}\*\///ge - %s/;}/}/ge - wq! - ' + cat ${stylesheet} | tr -d '\n' | sed ' + s|\s*\([:;,{}()]\)\s*|\1|g + s|;\}|\}|g + s|\t||g + s/\/\*\|\*\//\t/g + s|\t[^\t]*\t||g + ' > ${min_stylesheet} done + + touch ../src/.last_build } find_feeds() {