]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Define standard initializer as well as assets initializer 1711/head
authorGabe Kopley <gabe@coshx.com>
Tue, 5 Mar 2013 07:13:04 +0000 (23:13 -0800)
committerGabe Kopley <gabe@coshx.com>
Tue, 5 Mar 2013 07:13:04 +0000 (23:13 -0800)
lib/foundation/engine.rb

index 2dc9c79e6ded659a23694085a2b54ffebb8fc43a..812a81da510b0d73986190626697f5c261864d90 100644 (file)
@@ -1,12 +1,20 @@
 module Foundation
   class Engine < Rails::Engine
-    # auto wire assets
-    initializer 'foundation.update_asset_paths', :group => :assets do |app|
+    # Save this block, we'll use it in two calls to .initializer
+    add_paths_block = lambda { |app|
       app.config.assets.paths << File.expand_path("../../../scss", __FILE__)
       app.config.assets.paths << File.expand_path("../../../js", __FILE__)
 
       # Ensure Zepto and Modernizr are precompiled in production
       app.config.assets.precompile += %w(vendor/zepto.js vendor/custom.modernizr.js)
-    end
+    }
+
+    # Standard initializer
+    initializer 'foundation.update_asset_paths', &add_paths_block
+
+    # Special initializer lets us precompile assets without fully initializing
+    initializer 'foundation.update_asset_paths', :group => :assets,
+                &add_paths_block
+
   end
-end
\ No newline at end of file
+end