Last active
March 10, 2021 13:12
-
-
Save thenathanjones/88ccf785826ef880c45d2c89d3b3ce96 to your computer and use it in GitHub Desktop.
Simple templating script for inserting SSI tags back in the minified HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ssiFile=infra/ssi.txt | |
indexFile=build/index.html | |
tempDirectory=tmp | |
tempFile=$tempDirectory/index.html | |
mkdir -p $tempDirectory | |
awk 'NR==FNR{rep=(NR>1?rep RS:"") $0; next} {gsub("<ssi/>",rep)}1' $ssiFile $indexFile > $tempFile && mv $tempFile $indexFile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment