From 0f6c3072890bc52a3bc6bcf92a54ff35a7dcb91f Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Thu, 10 Jun 2021 07:13:20 -0500 Subject: updated readme --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) 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. -- cgit v1.2.3