Last active
April 17, 2017 20:55
-
-
Save halferty/ea537fb32fd176e9daee51afd6dd50ea to your computer and use it in GitHub Desktop.
Disable rails sprockets cache in development (probably so it's contents don't show up in your IDE's search results)
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
# in config/initializers/disable_sprockets_cache_in_dev.rb | |
if Rails.env.development? | |
module Rails | |
class Application | |
def assets | |
@assets ||= Sprockets::Environment.new(root.to_s) do |env| | |
env.version = ::Rails.env | |
path = "#{config.root}/tmp/cache/assets/#{::Rails.env}" | |
env.cache = Sprockets::Cache::MemoryStore.new 100_000_000 | |
env.context_class.class_eval do | |
include ::Sprockets::Rails::Helper | |
end | |
end | |
end | |
attr_writer :assets | |
# Returns Sprockets::Manifest for app config. | |
attr_accessor :assets_manifest | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment