盆栽 Bonsai

Getting started with Bonsai

If you’re using a Mac the good news is that Bonsai is dirt simple to get running. To install Bonsai, open Terminal.app and run sudo gem install bonsai.

Bonsai has a built in web server, so you won’t need to fiddle about with any other software.

Once installed typing bonsai --help will display a list of available options.

$ bonsai --help  

盆栽
bonsai, tiny and beautiful

  --plant [NAME]
  --repot       
  --cultivate   
  --version     
  --console     

To create the required framework for your new site, use bonsai --plant jasper, the generator will create your framework in ./jasper.

The Bonsai generator will create an index page, .htaccess for apache, base.less and a default mustache template.

If you’re uninterested in using less, simply rename your base.less file to base.css.

Any .less or .sass files added to the public/ directory will be processed with less and sass respectively.

You don’t have to use mustache either - Bonsai uses ”Tilt”, to use another templating engine, simply change the file extension.

To use Bonsai’s built in server while building your website. Run bonsai --cultivate from within your generated framework (cd ./jasper). your web browser of choice will open.

When you save, add or remove files bonsai --cultivate will also process your assets (images, js, and css).

Bonsai decides to give you some defaults using tools that I’d consider the best available for a well designed hierarchical site. To get a better grasp of how Bonsai works, plant your first now.