Permalink
Browse files

Add Barista.configure, misc doc changes

  • Loading branch information...
1 parent 8823fb6 commit 649716544b542b00a866f01e915e9eee09d70eea @Sutto committed Apr 26, 2010
Showing with 24 additions and 4 deletions.
  1. +19 −3 README.md
  2. +5 −1 lib/barista.rb
View
@@ -4,9 +4,9 @@ Barista is very, very similar to [bistro\_car](http://github.com/jnicklas/bistro
code / is almost a fork).
The main difference being, it lets you use coffee as you would javascript. Simply put, Write coffee
-and place it in `app/scripts` and Barista will automatically serve it as if it was placed in `public/javascripts`
+and place it in `app/coffeescripts` and Barista will automatically serve it as if it was placed in `public/javascripts`
-That is, `app/scripts/demo.coffee` will work for `/javascripts/demo.js`. Even better (and more importantly
+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`.
If you're using Jammit, this means you can simple run a rake task (`rake barista:brew` before running jammit) and
@@ -23,4 +23,20 @@ As you place .coffee files in app/scripts, it will automatically handle them for
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 require rails 3+ (but patches for Rails 2 will be accepted.)
+
+## Configuration ##
+
+Please note that barista lets you configure several options. To do this,
+it's as simple as setting up an initializer with:
+
+ rails g barista:barista_install
+
+Then editing `config/initializers/barista_config.rb`.
+
+Currently available options are:
+
+* root - the folder path to read coffeescripts from, defaults to app/coffeescripts
+* output\_root - the folder to write them into, defautls to public/javascripts.
+* no\_wrap - stop coffee from automatically wrapping JS in a closure.
+
View
@@ -8,8 +8,12 @@ module Barista
class << self
+ def configure
+ yield self if block_given?
+ end
+
def root
- @root ||= Rails.root.join("app", "scripts")
+ @root ||= Rails.root.join("app", "coffeescripts")
end
def root=(value)

0 comments on commit 6497165

Please sign in to comment.