Skip to content

Commit

Permalink
Prepare to bump the gem version, start updating the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sutto committed Jan 1, 2011
1 parent e1afc6f commit 75b217f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
40 changes: 32 additions & 8 deletions README.md
@@ -1,14 +1,37 @@
# Barista #

Barista is a rails plugin that transparently compiles CoffeeScript to JavaScript. When a `.coffee` file is changed and the page is refreshed, it delays sending the `.js` file until it's been regenerated from the newly modified CoffeeScript. This way, you can refresh immediately after saving the `.coffee` file, and not worry about an old `.js` file being sent to the browser (as often happens when using `coffee --watch`).
Barista is a set of tools to make using [CoffeeScript](http://jashkenas.github.com/coffee-script/) in Rails 3, Rails 2 and Rack applications
easier. You can think of it as similar to [Compass]() but instead of for Sass, it's for CoffeeScript.

Barista supports using `therubyracer` when installed or, by default, the node.js version of CoffeeScript via the `coffee` executable.
Getting started is fairly simple - The short version for Rails 3 is simply:

Barista is very, very similar to [bistro\_car](http://github.com/jnicklas/bistro_car) (infact, credit where credit is due - it shares similar
code / is almost a fork).
1. Add `gem 'barista', '~> 1.0'` to your Gemfile
2. Run `bundle install`
3. Run `rails generate barista:install`

The main difference being, it lets you use coffee as you would javascript. Simply put, Write coffee
and place it in `app/coffeescripts` and Barista will automatically serve it as if it was placed in `public/javascripts`
Place your CoffeeScript's in `app/coffeescripts` and Barista will automatically compile them on change into `public/javascripts`.


As an added bonus, Barista also gives:

* Automatic support for a `:coffeescript` filter in Haml (when Haml is loaded before barista) - Automatically converting inline CoffeeScript
to JavaScript for you.
* Where possible, support for `coffeescript_include_tag` and `coffeescript_tag`.
* When possible, instead of pre-compiling in development and test modes, Barista will embed CoffeeScript in the page for you.
* Support for Heroku via `therubyracer` and either pre-compiled JS or, optionally, a lightweight Rack app that generates on request.


## General Information

Barista transparently compiles CoffeeScript to JavaScript - When a `.coffee` file is changed and the page is refreshed, it first regenerates all `.js` files whose `.coffee` sources have been recently changed. This way, you can refresh immediately after saving the `.coffee` file, and not worry about an old `.js` file being sent to the browser (as often happens when using `coffee --watch`).

Barista supports using `therubyracer` when installed or, by default, using either the `node` executable or `jsc` (on OSX) to compile your scripts. There is
no need for you to install the coffee script executable in node - having Node itself or any of the alternatives available is enough for you to get support.

## Alternative

Barista started out as a very-closed alternative to [bistro\_car](http://github.com/jnicklas/bistro_car). Since then, it's evolved
an awful lot. These days, Barista includes

That is, `app/coffeescripts/demo.coffee` will work for `/javascripts/demo.js`. Even better (and more importantly
for me), it provides `Barista.compile_all!` which takes all coffee files and compiles them into `public/javascripts`.
Expand All @@ -18,7 +41,7 @@ your coffeescripts will be automatically provided, ready for bundling.

To add to your project, simply add:

gem 'barista', '>= 0.5.0'
gem 'barista', '~> 1.0'

To your Gemfile and run bundle install.

Expand All @@ -27,7 +50,8 @@ As you place .coffee files in app/coffeescripts, it will automatically handle th
Please note that for Jammit compatibility etc, by default in test and dev mode it will
automatically compile all coffeescripts that have changed before rendering the page.

Barista require rails 3+ (but patches for Rails 2 will be accepted.)
Barista works out of the box with Rails 3 (and theoretically, Rails 2) - with support for Rack if
you're willing to set it up manually.

## Frameworks ##

Expand Down
6 changes: 3 additions & 3 deletions lib/barista/version.rb
@@ -1,8 +1,8 @@
module Barista
module Version
MAJOR = 0
MINOR = 7
MAJOR = 1
MINOR = 0
PATCH = 0
STRING = [MAJOR, MINOR, PATCH, 'pre3'].join(".")
STRING = [MAJOR, MINOR, PATCH].join(".")
end
end

0 comments on commit 75b217f

Please sign in to comment.