# andrefincato.info javascript is online space of torture. moving from [choo.js / spa](https://github.com/afincato/andrefincato/tree/v4), to txt files and pandoc templates to output self-contained html documents (including css, fonts, and images). - [basic pandoc-to-html ref](https://bitfragment.net/mindoc/) - [great ref for html optimization](https://k1ss.org//blog/20191004a) - [nice guide on using nginx for static websites](https://medium.com/@jgefroh/a-guide-to-using-nginx-for-static-websites-d96a9d034940) - [static-site generator as posix script](https://www.paritybit.ca/blog/rewriting-my-static-site-generator) - [lowdown](https://kristaps.bsd.lv/lowdown/), possible pandoc alternative? - [sblg](https://kristaps.bsd.lv/sblg/) in combination to lowdown to create custom html pages? ## pandoc build ``` pandoc content/index.txt --template templates/index.html -o dist/index.html -V commit_date="$(git log -n 1 --pretty=format:%cd --date=format:'%Y-%m-%dT%H:%M:%S' -- content/index.txt)" -V commit_hash="$(git log -n 1 --pretty=format:%h -- content/index.txt)" ``` or ``` pandoc content/notfound.txt --resource-path=./content --template=../templates/notfound.html --self-contained -o dist/notfound.html ``` ## list file revision ``` git ls-files | grep content | while read -r line ; do git log -1 --pretty=format:"%h" -- $line | xargs -I {} rg {} -l dist/* ; done ``` - get list of files being tracked by git - grep to get back only the `content` folder - start a while loop to read each line and assign value to `$line` - run a command to retrieve the latest git commit (short format, `%h`) of each line (each file) - take each hash and use it to (rip)grep through the dist folder recursively, and show only the filename of each match *or* rather than diffing between the latest hash of a file and grepping for it on it output in `dist` — this assumes that file has been converted to html at least once — take a step back and bind the publishing process more closely to git: show which files have been changed and in which way (added [A], modified [M], deleted [D]) ``` git diff --name-status -- content ``` returns the following ``` M content/notfound.txt D content/test.txt ``` then upon staging and committing, run a post-hook to either convert the file to html or delete the existing file from the dist folder. possibly overall easier? ## updates ### 2020-11-07 - just moved from fully self-contained documents to have link-ref to `assets/styles.css`. - still embedding web-fonts with base64 on stylesheet - the template `notfound`, which has an image, is the only one being converted by pandoc as `--self-contained`, so the images is converted to base64 - things are a bit messy after this change, but as the website is growing a little bit, repeating the same css (by using `