Brain Phrye

code cooking diy fiction personal photos politics reviews tools 


Standards Encouraged Kludge

The software that generates this blog is hugo, a static site generator. To deploy this I have a Makefile that runs hugo but also runs some other bits. One of them minifies the html to get them to the browser as fast as possible.

As it turns out minify upsets the unicorn. Specifically it changes href = "" attributes for the a tag to just href. I tried fixing it in hugo - and I could - but it was pretty dirty. So in the end I fixed it with sed. That just changed those to href="#". A kludge, but it works.

1
2
3
4
5
6
7
8
9
publish: hugo minify
	rm -rf output
	hugo --baseURL $(BASEURL)
	find output -name '*.html' -print0 | xargs -0 sed -i 's/href = ""/href="#"/'
	minify -o output -r output
	make -C src/thanksgiving-2016-menu publish
	make -C src/thanksgiving-2017-menu publish
	make -C src/titanhq-bake-off-2018-menu publish
	make -C src/thanksgiving-2018-menu publish