steshaw / ema-template

Template repo for Ema static site generator

Home Page:https://srid.github.io/ema-template/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ema Template

A very simple example Ema site that is based on Blaze HTML & TailwindCSS 3. Use it to bootstrap your next static site using Ema.

The generated HTML site can be previewed here: https://srid.github.io/ema-template/

Getting Started

To develop with full IDE support in Visual Studio Code, follow these steps:

  • Install Nix & enable Flakes
  • Setup the Nix binary cache, unless you are okay with compiling for hours.
  • Run nix develop -i -c haskell-language-server to sanity check your environment
  • Open the repository as single-folder workspace in Visual Studio Code
    • Install the recommended extensions
    • Ctrl+Shift+P to run the command "Nix-Env: Select Environment" and select shell.nix. The extension will ask you to reload VSCode at the end.
  • Press Ctrl+Shift+B in VSCode, or run nix develop -c , run in terminal, to launch the Ema dev server, and navigate to http://localhost:9001/

All but the final step need to be done only once. Check the Ema tutorial next.

Note

  • This project uses relude as its prelude, as well as Tailwind+Blaze as CSS utility and HTML DSL. Even though the author highly recommends them, you are of course free to swap them out for the library of your choice.
    • Tailwind CSS is compiled, alongside Ghcid, via foreman (see flake.nix)
  • As a first step to using this template, rename your project using https://srid.ca/haskell-template/start#rename-the-project (use ema-template in place of haskell-template)
  • Configuration:
    • To change the port (or the Ema CLI arguments, used by nix develop -c , run), see ./.ghcid (if you leave out --port a random port will be used)
    • To add/remove Haskell dependencies, see http://srid.ca/haskell-template/dependency
  • To generate the site, run:
    nix build .#site
    # Alternatively:
    # > mkdir ../output 
    # > nix run . -- --base-url=/ gen ../output

Non-Nix workflow

To use this repository without Nix (such as with plain Cabal or Stack) you need to have the following installed manually:

Once all the above are installed and setup, run foreman start to start the Ema live server.

About

Template repo for Ema static site generator

https://srid.github.io/ema-template/

License:Creative Commons Zero v1.0 Universal


Languages

Language:Haskell 53.8%Language:Nix 46.2%