• Stars
    star
    296
  • Rank 139,341 (Top 3 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 15 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tiny static web site generator

bonsai

Build status

Bonsai is a static web site generator, it uses the best tools available for site construction and adheres to best web practices.

What it does

  • Provides a tiny HTML5, liquid driven template set.
  • Implies a simple structure to get started faster.
  • An inbuilt server for development. No setup required.
  • Tasks to export the site to output. Upload the contents of output. Job done.
  • Access to page hierarchy through children, siblings, ancestors and navigation.
  • Generates sitemap.xml ready for search engines to spider your site.
  • Generates robots.txt to be friendly to search engines.

Getting started

  • Install bonsai

    gem install bonsai

  • Run the generator

    bonsai --plant [NAME]

Type bonsai --help for any help with commands

Presentation

  • Introducing Bonsai - at Melbourne Ruby, January 2010

Development server

Unlike other static generators, bonsai provides you with a built in web server. Once you've generated the necessary files (generator included) you can simply start developing. Type bonsai --cultivate in the root of the generated site, a web server (rack, with thin) will start up.

It will also watch for when you save files - taking care of processing your sass files - kind of like autotest.

Production server

This is the cool part. Drop a bonsai generated site under pretty much anything. Apache, Nginx, Lighttpd - I don't care.

The generator will provide you with a .htaccess file that will turn on gzip/deflate compression for static assets as well as set long standing http caching timestamps and etags.

Deployment

  • Run bonsai --repot
  • Upload the contents of site-root/output to your production server
    • For example: rsync -ave ssh ./output/ tinytree.info:/var/www/tinytree.info

Ruby implementations

Bonsai runs under a number of Ruby implementations, MRI (1.8.7, 1.9.1, 1.9.2, 1.9.3), RBX (1.8 mode), JRuby (1.8 mode, 1.9 mode). Check travis to see the specifics.

Have you used this for a real job?

Yes. I built (and content filled) a web site with around 160 pages in 5 days.

When I found something that didn't quite work, was too slow or perhaps not even possible I wrote a spec and implemented it later. Better software from real requirements. (I used every feature I implemented)

Links

Thanks

  • Anthony Kolber for writing, then rewriting Stacey from scratch. We spent many hours talking about best practice and software UX.
  • Lincoln Stoll for reminding me to use the tools that I know best

Credits

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2010 Ben Schwarz. See LICENSE for details.

More Repositories

1

gallery-css

CSS only Gallery
CSS
1,138
star
2

metaquery

A declarative responsive web design syntax. Breakpoints, defined in `<meta>`
JavaScript
324
star
3

passenger-stack

Sprinkles for Apache, Passenger, Memcached, Git, Mysql or Postgres
Ruby
315
star
4

currency.io

An offline-capable, html5 currency converter app for the iPhone
JavaScript
296
star
5

sublime-bower

Install Bower packages from within Sublime
Python
228
star
6

developers.whatwg.org

Used to create the contents of developers.whatwg.org
198
star
7

amnesia

A Sinatra rack middleware that presents memcached server stats
Ruby
177
star
8

am-grid

Experiemental attribute module grid system
CSS
81
star
9

cache.js

localStorage with timed expiry
JavaScript
55
star
10

smoke

It isn't ready yet
Ruby
47
star
11

bonsai-site

The Bonsai web site source
JavaScript
29
star
12

open-uri-memcached

Ruby's OpenURI with Memcached for caching
Ruby
24
star
13

bom-weather

Weather from the Australian Bureau of Meteorology
Ruby
24
star
14

w3c-spec-styles

An alternate stylesheet for W3C specification pages
JavaScript
23
star
15

heroku-electron-buildpack

Shell
20
star
16

postie

A Sinatra based Rack middleware that provides Australian postcode information via JSON
Ruby
18
star
17

responsive-sass

The source files to a screencast
Ruby
12
star
18

choones

A jQuery plugin to provide monologue style messaging. Inspired by Growl's music video theme.
JavaScript
11
star
19

registry

For dirt simple plugin architecture
Ruby
11
star
20

bower-badges

Show that your project is available in Bower by using a bower badge!
JavaScript
11
star
21

skeet

a heroku ready screen shot application
Ruby
11
star
22

leonardo

A simple ass, half done sparkline graph using Raphael
JavaScript
9
star
23

yahoo-stock

A Yahoo! stocks scraper
Ruby
9
star
24

muxtape-rb

A ruby based gem to download muxtapes
Ruby
9
star
25

grid

A tiny grid system.
Ruby
9
star
26

gifcity

JavaScript
9
star
27

munch

A simple sinatra app to test yahoo pipes to pull down recipes from many web sites
Ruby
9
star
28

transcoder

Transcode from common web based formats into plain old Ruby
Ruby
9
star
29

chrome-request-interception

JavaScript
9
star
30

html5forAuthors

HTML5 (Edition for Web Authors)
JavaScript
8
star
31

rack-smoke

Expose Smoke sources and transcode them into JSON, XML or YAML
Ruby
7
star
32

flickr-rest

A light interface to call flickr 'restful' api methods
Ruby
7
star
33

HTML5.tmbundle

Ruby
7
star
34

flickr-wrapper

A dead project. Here for nostalgia and reference
Ruby
6
star
35

homebrew-sassc

Ruby
6
star
36

Hillegass-Macruby

Cocoa Programming for Mac OS X examples rewritten for MacRuby
Ruby
5
star
37

watch

A simple directory watcher
Ruby
4
star
38

ae

A rack middleware to allow for accessibility on any page.
4
star
39

gitnotify

Enables a post-commit hook to your repositories that sends growl notifications around your local network
Ruby
4
star
40

benschwarz-site-v2

My *new* web site
Ruby
3
star
41

railscamp-13

JavaScript
3
star
42

attr-chain

attr_chain for chainable, single method attribute (get|setters)
Ruby
2
star
43

openuri_recorder

Its like a VCR for the web that you can take on the plane with you
Ruby
2
star
44

benschwarz

2
star
45

smoke-manual

A book about smoke, the ruby dsl
Ruby
2
star
46

html5-workshop-site

The web site from which I'll release details about my HTML5 workshop
JavaScript
1
star
47

dotjs

My ~/.js extensions
JavaScript
1
star