Bamboo theme

I just separated bamboo into

  • core
  • themes

So the engine can have multiple front-end, bamboo is also more lightweight :)

/==============================\
| code                 :  1436 |
| comment              :   106 |
|------------------------------|
| ratio:                       |
|   comment/code       :  0.07 |
\==============================/

As a result, when bamboo is bootstrapped by bamboo-launcher, the launcher imports both bamboo and bamboo-theme-blueprint, and download the template db directory accordingly.

Some attention to software engineering makes bamboo -Wall -fno-warn-orphans clean.

A note on using theme, there are 3 parts from a theme:

  • a theme module to import, this happens in code, as theme is now a parameter to the bamboo middleware
  • a theme specific resource pointer, this is configured in site.txt:theme_name, you then put js and css config options inside db/config/theme/theme_name.txt, see db/config/theme/blueprint.txt for example. The reason to have a theme resource field in site.txt is to allow the theme to be configured without re-compililation, which might take some time. However, a theme is not required to use the resource field.
  • the actual theme resource, placed under db/public/theme/theme_name, e.g. db/public/theme/blueprint.

So a theme is about both the code, that generates html, and static resources, referred from html. There could be a better approach, but I think separating code and data should be a pleasant experience.

The same applies to developing a theme, you need to provide both the code and data.

Finally the theme interface:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Bamboo.Type.ThemeInterface where

import Bamboo.Type.State (State)
import Hack (Response)

data Interface =
Index
| IndexFeed
| Post
| Static
| Tag
| TagFeed
| Search
deriving (Show, Eq)

type Theme = Interface -> State -> IO Response
blog comments powered by Disqus