-
Notifications
You must be signed in to change notification settings - Fork 2
Rails
Assuming you have a proper ruby, rails and gem setup, all you need to do to install JS2 is to include it in your Gemfile. Presumably, you want to compile your JS2 files in development mode and already have your target Javascript files checked in to your source control. If this is so, add this to your Gemfile:
group(:development) do
gem 'js2'
end
Otherwise, just put:
gem 'js2'
Now run:
bundle install
At this point, you should have js2 installed. Now you can hook it into rails to compile automatically in development mode by adding JS2::Rack to your middleware. In ./config/environments/development.rb, add this line:
config.middleware.use JS2::Rack
By default JS2 will look in "app/js2" for your source files (anything with a js2 extension) and write normal javascript to "public/javascripts". You can change this by creating a "./config/js2.yml" file.
TODO