A Clojure library of tools for developing static web sites.
Well, that's exactly it. I didn't want to use a framework. I don't like the restrained feeling I get when using them. I prefer coding things over messing around with configuration files.
I want to
Statis offers a few functions that are pretty useful when creating static web sites.
No more. There are no batteries included.
If you want a framework that makes it really quick and easy to create a blog, you should take a look at these:
They generally come with a folder where you put your blog posts in some templating language, and a set of configuration options about how to set up your blog. They often generate code for you to tweak.
The core of Stasis is two functions: serve-pages
and export-pages
. Both take a map from path to contents:
(def pages {"/index.html" "<h1>Welcome!</h1>"})
The basic use case is to serve these live on a local server while developing - and then exporting them as static pages to deploy on some server.
Stasis can create a Ring handler to serve your pages.
(ns example (:require [stasis.core :as stasis])) (def app (stasis/serve-pages pages))
Like with any Ring app, you point to your app
in project.clj
:
:ring {:handler example/app}
and start it with lein ring server-headless
.
To export, just give Stasis some pages and a target directory:
(defn export [] (stasis/export-pages pages target-dir))
When you've got this function, you can create an alias for leiningen:
:aliases {"build-site" ["run" "-m" "example/export"]}
and run lein build-site
on the command line. No need for a lein plugin.
The static page that prompted me to write Stasis is currently closed source, but I'm in the process of turning my 4 other static sites over. The simplest, and first to be done, is:
I'm also working on the Emacs Rocks! webpage, where I'll use hiccup instead of Enlive.
It's still on a 0.x release, but I feel the API has jelled enough now to open source it. I don't expect any major changes at this point. I'll likely push it to 1.0 at the end of the month.
I think the existing frameworks are great if they fit your style. Stasis imposes no styles. There are very few decisions made for you - no markdown vs asciidoc, no enlive vs hiccup. No configuration options. You have to make them.
So, yeah ... I think Stasis would be a great starting point if you want to create the 6th static site framework to go in that list at the top. :-)
- Magnar
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/nHaYzpcQpmc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No configuration options. You have to make them.
Very minimalist. I appreciate that.
This makes sharing implementations easier. The stasis way to do this is for everyone to write it and integrate themselves. Often the later is more fun and offers a bit more control, but the former is easier.
Maybe Incise could even use Stasis as a lib to build its more elaborate features on top of?