diff options
author | José Valim <jose.valim@gmail.com> | 2011-04-17 11:44:52 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-04-17 11:44:52 +0200 |
commit | 3a68aec1a1c6329bfcbf0f87bdc2fbd75cb98feb (patch) | |
tree | db2df7eaca91860f9ea6e57c0ef3b13b682cfc82 /actionpack/lib/sprockets/railtie.rb | |
parent | 8f75c3abcde4f2ff64e855178027e1bd93976de9 (diff) | |
download | rails-3a68aec1a1c6329bfcbf0f87bdc2fbd75cb98feb.tar.gz rails-3a68aec1a1c6329bfcbf0f87bdc2fbd75cb98feb.tar.bz2 rails-3a68aec1a1c6329bfcbf0f87bdc2fbd75cb98feb.zip |
Make generators more modular, add hooks and improve test suite.
Diffstat (limited to 'actionpack/lib/sprockets/railtie.rb')
-rw-r--r-- | actionpack/lib/sprockets/railtie.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/lib/sprockets/railtie.rb b/actionpack/lib/sprockets/railtie.rb index 5006a3a575..e87382f29d 100644 --- a/actionpack/lib/sprockets/railtie.rb +++ b/actionpack/lib/sprockets/railtie.rb @@ -3,6 +3,23 @@ require "sprockets" # TODO: Move this to sprockets-rails # If so, we can move the require to a Gemfile and remove assets.enabled class Sprockets::Railtie < Rails::Railtie + def self.using_coffee? + require 'coffee-script' + defined?(CoffeeScript) + rescue LoadError + false + end + + def self.using_scss? + require 'sass' + defined?(Sass) + rescue LoadError + false + end + + config.app_generators.javascript_engine :coffee if using_coffee? + config.app_generators.stylesheet_engine :scss if using_scss? + # Configure ActionController to use sprockets. initializer "sprockets.set_configs", :after => "action_controller.set_configs" do |app| ActiveSupport.on_load(:action_controller) do |