From 3a68aec1a1c6329bfcbf0f87bdc2fbd75cb98feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 17 Apr 2011 11:44:52 +0200 Subject: Make generators more modular, add hooks and improve test suite. --- actionpack/lib/sprockets/railtie.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'actionpack/lib') 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 -- cgit v1.2.3