Last year, I released my Elm-to-Html static site generator, Elmstatic.
As it relied on elm-static-html-lib
(which I wrote about), I had to wait for this library to be updated to Elm 0.19 first. However, the update didn’t happen, possibly because it relied on the now defunct Elm native modules, or because the author has moved on to other things.
I finally rolled up my sleeves and came up with a different solution, changing a lot of the inner workings in the process.
The current set of features is:
elm-ui
, html
or any other package that generates Html msg
values)elm-css
stylesheets in Elm code (but you can use plain old stylesheets if you like)Elmstatic remains an early stage project for now: error handling is limited, and I haven’t done any performance optimisation. However, I’m using it for korban.net, so it’s not just a prototype!
Compared to the previous version (0.3.4), the workflow remains largely the same, but the way the content and code is organised has changed:
elm-ui
, the scaffold generated by elmstatic
now uses html
and elm-css
in order to provide a responsive template. You’re still free to use elm-ui
or any other package that produces Html msg
values, however.template.html
.config.json
instead of Elm code, as this is simpler.Note: these changes are not backwards compatible with v0.3.4.
One of the advantages of the new implementation is that because I’m able to run arbitrary JavaScript, I can convert Markdown to HTML using elm-explorations/markdown
(which relies on a JavaScript library under the hood). Previously I had to use pablohirafuji/elm-markdown, a pure Elm package for parsing Markdown and rendering HTML, which had a few limitations.
You can install Elmstatic from NPM:
$ npm install -g elmstatic
Running elmstatic init
in a directory will generate a site scaffold. Change the generated files to your liking, then generate the output by simply running elmstatic
without arguments.
Finally, run an HTTP server in the output directory to check out the result:
$ cd _site
$ http-server
For more details: