Created
March 12, 2012 15:11
-
-
Save nhunzaker/2022542 to your computer and use it in GitHub Desktop.
Precompiling Assets for Spree Variant Options Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spree_core' | |
require 'spree_sample' unless Rails.env == 'production' | |
# All of the magic happens at the line "if Rails.version >= 3.1 ... " | |
# found in spree_variant_options/lib/spree_variant_options.rb | |
module SpreeVariantOptions | |
class Engine < Rails::Engine | |
config.autoload_paths += %W(#{config.root}/lib) | |
# Enabling assets precompiling under rails 3.1 | |
if Rails.version >= '3.1' | |
initializer :assets do |config| | |
Rails.application.config.assets.precompile += %w( store/products.js store/variant_options.js store/variant_options.css ) | |
end | |
end | |
config.to_prepare do | |
#loads application's model / class decorators | |
Dir.glob File.expand_path("../../app/**/*_decorator.rb", __FILE__) do |c| | |
Rails.configuration.cache_classes ? require(c) : load(c) | |
end | |
#loads application's deface view overrides | |
Dir.glob File.expand_path("../../app/overrides/*.rb", __FILE__) do |c| | |
Rails.application.config.cache_classes ? require(c) : load(c) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment