Skip to content

Instantly share code, notes, and snippets.

@halferty
Last active April 17, 2017 20:55
Show Gist options
  • Save halferty/ea537fb32fd176e9daee51afd6dd50ea to your computer and use it in GitHub Desktop.
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)
# 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