Skip to content

codetalkio/codethoughts.io

Repository files navigation

Dependencies

You'll need sass/compass to compile the (S)CSS files, else hakyll will complain in the build phase.

$ npm i -g sass

To avoid needing to rebuild the entire Haskell application, you can use the ready-made binary (Linux only),

$ gh release download --pattern "hakyll-site" --dir ./dist
$ chmod +x ./dist/hakyll-site
$ ./dist/hakyll-site watch

Quick walkthrough of Hakyll

If you change something in site.hs, then it needs to be recompiled, using GHC. Everything else, should just need a rebuild via Hakyll.

$ stack build

After this, rebuilding the site is as simple as,

$ stack exec -- hakyll-site rebuild

or, alternatively use watch to launch a preview server while developing,

$ stack exec -- hakyll-site watch
$ sass resources/scss/app.scss:_site/app.css --style compressed --watch

Image Optimization

$ brew install imagemagick

Either put the images in resources/images/unoptimized, or copy them with the following script,

$ cd resources/images
$ mkdir -p unoptimized
$ for f in *.png; do cp "$f" "unoptimized/${f%.png}.thumbnail.png"; done

Now that the images you want to generate optimized versions for are in resources/images/unoptimized, run the optimization script inside this folder,

$ cd unoptimized
$ mogrify -resize 50% *.thumbnail.png

Finally, copy them out to images again.