Skip to content

Commit eed795f

Browse files
author
Tasveer Singh
committed
Add Configuration section
1 parent 3f72398 commit eed795f

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,34 @@ That's it!
2727

2828
Note that it will render whatever is returned from JavaScript.
2929

30+
## Configuration ##
31+
32+
You can configure the following options:
33+
34+
environment # The environment in which to execute the JavaScript. For example, you can load the Jade templating library into this.
35+
coffeescript_environment # Will take CoffeeScript, compile it, and set environment to that
36+
37+
`render_execjs` supports four syntaxes for setting configuration options (using the environment option as an example):
38+
39+
RenderExecJS.configure do
40+
self.environment = "'js environment'"
41+
environment "'js environment'"
42+
end
43+
44+
RenderExecJS.environment = "'js environment'"
45+
RenderExecJS.environment "'js environment'"
46+
47+
And two for getting configuration options:
48+
49+
RenderExecJS.configure do
50+
self.environment # => will return the environment
51+
end
52+
53+
RenderExecJS.environment # => will also return the environment
54+
3055
## Why would I want to render JavaScript from Rails? ##
3156

32-
Make sure that you're logged into your Twitter, now click on this link: [http://twitter.com/tazsingh](http://twitter.com/tazsingh)
57+
Make sure that you're logged into your Twitter, now click on this link: [http://twitter.com/tazsingh](http://twitter.com/tazsingh).
3358
Notice how it loads your Twitter first, then the page that you've requested?
3459

3560
It has to initialize the JavaScript environment before it can render the page you've requested.

0 commit comments

Comments
 (0)