sc0ttj / mdsh

A simple static site generator, using Markdown and Bash
https://sc0ttj.github.io/mdsh/
10 stars 0 forks source link

HTML minification breaks code formatting #61

Open sc0ttj opened 5 years ago

sc0ttj commented 5 years ago

To do

Fix the sed command at the bottom of .app/minify.sh, so that it excludes the contents of <pre> tags when minifying the HTML.

See here: https://unix.stackexchange.com/questions/519788/how-do-i-exclude-pre-tags-from-html-minification-using-sed

sc0ttj commented 4 years ago

Fix is in this post: http://murga-linux.com/puppy/viewtopic.php?p=1048208#1048208

sc0ttj commented 4 years ago
sed ':a;$!{N;ba;};s/@/@a/g;s/\n/@n/g;s/<pre/\n&/g;s/<\/pre>/&\n/g' test.html \
  | sed -r '/(^<pre|<\/pre>$)/!{s/@n//g;s/>\s+</></g;}' \
  | sed ':a;$!{N;ba;};s/\n//g;s/@n/\n/g;s/@a/@/g' >min.html