summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2021-06-10 07:13:20 -0500
committerColin Okay <okay@toyful.space>2021-06-10 07:13:20 -0500
commit0f6c3072890bc52a3bc6bcf92a54ff35a7dcb91f (patch)
treeca6fc741add1041c454df2d74e3a1df7badae3d9
parenteb13f7eb227f1775d978de82e670348eef21ab8b (diff)
updated readme
-rw-r--r--README.md55
1 files changed, 55 insertions, 0 deletions
diff --git a/README.md b/README.md
index b5345b6..f6cd973 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,61 @@ The idea is this:
- The recipie then uses those resources to build "artifacts", which are mostly pages.
2. You then pass the recipie to a function that builds and publishes the site.
+## A Basic Example
+
+``` lisp
+;; A recipe. Makes a single page.
+(defun my-site-recipe ()
+ (page-with-main-layout "/index.html" 'index-page-content))
+
+```
+
+The above recipe is a function of zero arguments. It will be called by
+builder functiosn in a special context where a few dynamic varibles
+are approrpiately assigned.
+
+The `page-with-main-layout` is a template defined like so:
+
+``` lisp
+
+(define-spinneret-template page-with-main-layout
+ (url content-view)
+ (:html
+ (:head
+ (:meta :name "viewport" :content "width=device-width, initial-scale=1")
+ (:body
+ (:div :class "main-layout"
+ (funcall content-view)))))
+
+```
+
+Notice that the template is defined to accept a single argument `content-view`.
+
+``` lisp
+
+(defun index-page-content ()
+ (with-html
+ (:h2 :class "center" "A Heading")
+ (:p "Some text.")))
+
+```
+
+You can then build it to disk by doing:
+
+``` lisp
+
+(build-and-publish
+ 'my-site-recipe
+ #P"/home/me/sites/my-site" ; where files end up
+ "https://example.com") ; the host where this is intended to be served
+
+```
+
+But while you are developing a site, you're unlikely to use
+`build-and-publish` very much. Flexo is mainly for interactive
+development of static sites:
+
+
## Interactive development
The real benefit of flexo is interactive development.