Skip to content
This repository
Browse code

Add use_sprockets flag

  • Loading branch information...
commit 954d73df5312f4829c96a76f1929e45597e85680 1 parent 7197eb7
Joshua Peek josh authored
4 railties/lib/rails/application/configuration.rb
@@ -9,8 +9,7 @@ class Configuration < ::Rails::Engine::Configuration
9 9 :filter_parameters, :helpers_paths, :logger,
10 10 :preload_frameworks, :reload_plugins,
11 11 :secret_token, :serve_static_assets, :session_options,
12   - :time_zone, :whiny_nils,
13   - :compile_assets
  12 + :time_zone, :whiny_nils
14 13
15 14 attr_writer :log_level
16 15
@@ -29,7 +28,6 @@ def initialize(*)
29 28 @log_level = nil
30 29 @middleware = app_middleware
31 30 @generators = app_generators
32   - @compile_assets = []
33 31 end
34 32
35 33 def compiled_asset_path
4 railties/lib/rails/engine.rb
@@ -434,7 +434,7 @@ def env_config
434 434
435 435 def routes
436 436 @routes ||= ActionDispatch::Routing::RouteSet.new
437   - @routes.add_route(assets, {}, {}, {}, nil, false)
  437 + @routes.add_route(assets, {}, {}, {}, nil, false) if config.use_sprockets
438 438 @routes.append(&Proc.new) if block_given?
439 439 @routes
440 440 end
@@ -458,6 +458,8 @@ def assets
458 458 end
459 459
460 460 def build_asset_environment
  461 + return nil if !use_sprockets
  462 +
461 463 require 'sprockets'
462 464
463 465 env = Sprockets::Environment.new(root.to_s)
5 railties/lib/rails/engine/configuration.rb
@@ -5,12 +5,15 @@ class Engine
5 5 class Configuration < ::Rails::Railtie::Configuration
6 6 attr_reader :root
7 7 attr_writer :middleware, :eager_load_paths, :autoload_once_paths, :autoload_paths
8   - attr_accessor :plugins, :asset_path
  8 + attr_accessor :plugins, :asset_path, :use_sprockets, :compile_assets
9 9
10 10 def initialize(root=nil)
11 11 super()
12 12 @root = root
13 13 @generators = app_generators.dup
  14 +
  15 + @use_sprockets = false
  16 + @compile_assets = []
14 17 end
15 18
16 19 # Returns the middleware stack for the engine.

0 comments on commit 954d73d

Please sign in to comment.
Something went wrong with that request. Please try again.