Skip to content

Instantly share code, notes, and snippets.

@juliocesar
Last active December 19, 2015 18:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliocesar/5997750 to your computer and use it in GitHub Desktop.
Save juliocesar/5997750 to your computer and use it in GitHub Desktop.
Enabling caching in Sprockets
# Enables caching in Sprockets
# ============================
#
# I couldn't find it documented anywhere until I searched for it. Sprockets will recompile
# every file in a manifest for every request it serves if even *one* file in it changes,
# which it really slow for developing anything.
#
# This fixes that by ensuring only files that get changed get recompiled. NOTE: This is
# just an example. What you're looking for is in line 14.
Hopla.compiler = Sprockets::Environment.new Pathname(Hopla.Root) do |env|
# Cache.
env.cache = Sprockets::Cache::FileStore.new(Dir.tmpdir)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment