pdssg

Pandoc static site generator
Log | Files | Refs | README | LICENSE

commit b2a465d17ab4691dc9254819ee148213f4aa17bf
parent f0c1d44d1204446c6abdb80b0a5e8b0575490155
Author: Byron Torres <b@torresjrjr.com>
Date:   Thu, 15 Oct 2020 10:07:33 +0100

Minify all CSS files found in assets directory

Diffstat:
Mpdssg | 39++++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/pdssg b/pdssg @@ -68,26 +68,31 @@ prepare_dst() { rm $IGNORE_MD_FILE echo "Finding feeds home directory" - FEEDS_DIR="$(< ./_feeds)" + FEEDS_DIR="$(cat ./_feeds)" FEEDS_DIR=${FEEDSDIR:-./feeds} echo "Dir: $FEEDS_DIR" - STYLESHEET="./ast/style.css" - echo "Minifying CSS file $STYLESHEET" - vim $STYLESHEET -es --not-a-term +' - %s/\s*:\s*/:/g - %s/\s*;\s*/;/g - %s/\s*,\s*/,/g - %s/\s*{\s*/{/g - %s/\s*}\s*/}/g - %s/\s*(\s*/(/g - %s/\s*)\s*/)/g - %s/^\s*// - %s/\n// - %s/\/\*.\{-}\*\///g - %s/;}/}/g - wq! - ' + ASSETS_DIR="./ast" # No ending slash! + stylesheets=$(find -path "$ASSETS_DIR/*.css") + echo $stylesheets + for stylesheet in $stylesheets + do + echo "Minifying CSS file $stylesheet" + vim $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! + ' + done } find_feeds() {