hscc

Soure code of <https://hugo.soucy.cc>.
git clone git://soucy.cc/hscc.git
Log | Files | Refs

css.sh (1188B)


      1 #!/bin/sh
      2 # You can use it with entr to rebuild on change:
      3 # find . | entr -d ./css.sh
      4 
      5 dst="../../public_html/css/"
      6 
      7 # Top bundle loop
      8 # Return top.min.css in $dst
      9 while read -r line; do
     10   [ -n "$line" ] && cat "./$line"
     11 done <<-EOF | cssmin > "${dst}top.min.css"
     12 global/tokens/typography.css
     13 global/tokens/colors.css
     14 global/tokens/grid.css
     15 
     16 global/base.css
     17 global/a11y.css
     18 
     19 atoms/typography/titles.css
     20 atoms/typography/quotes.css
     21 atoms/buttons/button.css
     22 
     23 modules/go-to.css
     24 modules/header-banner.css
     25 modules/main.css
     26 modules/hentry.css
     27 modules/xfn.css
     28 EOF
     29 
     30 # Bottom bundle loop
     31 # Return bottom.min.css in $dst
     32 while read -r line; do
     33   [ -n "$line" ] && cat "./$line"
     34 done <<-EOF | cssmin > "${dst}bottom.min.css"
     35 modules/webmentions.css
     36 modules/nav.css
     37 modules/footer-banner.css
     38 EOF
     39 
     40 # Modular loop
     41 # Return minified CSS separately
     42 while read -r line; do
     43   dstname=$(basename "$line" .css) # basename without the .css extension
     44 
     45   [ -n "$line" ] && cssmin "./$line" > "${dst}$dstname.min.css"
     46 done <<-EOF
     47 modules/hcard.css
     48 modules/hfeed.css
     49 modules/nav-pagination.css
     50 modules/hresume.css
     51 modules/archives.css
     52 modules/tags.css
     53 print.css
     54 EOF
     55 
     56 echo "CSS builded! @ $(date +"%Y-%m-%d %T")"