Rebuilding assets on the command line ignores cache #103

statico opened this Issue Feb 11, 2012 · 7 comments


None yet
3 participants

statico commented Feb 11, 2012

We've got a lot of asset bundles (232) and building them all takes a long time (1-2 minutes). The cache configuration setting seems useful, but it seems that building the assets on the command line ignores the cache. (There's a lot of force=True in webassets/

It would be wonderful if a command-line build command could use the cache, or at least respect the cache config setting if it's set to True.



miracle2k commented Feb 11, 2012

force=True only means that the build code will not bail just because the output file is deemed up to date based on looking at timestamps. The cache should be in use.

Trying the latest head (though I do not recall any recent changes that would be relevant here) with a (small) project, this definitely seems to work:

 $ time ./ assets build
 real   0m5.230s
 user   0m4.960s
 sys    0m0.240s
 $ rm -rf ../media/gen/   # Deleting output files to be positive they are generated
 $ time ./ assets build
 real   0m0.486s
 user   0m0.340s
 sys    0m0.130s

Ensure that the .webassets-cache directory (in the media directory) is created and populated with files (that should ensure that the cache is correctly enabled).

Also note that if your bundle is using the "depends" option for sass compilation and the like, the cache will not be used. This is because the contents of those files do not affect the cache key, which would lead to changes being ignored.


miracle2k commented Feb 11, 2012

I just added a --no-cache option to the build command in c9a2e7b which might help with debugging.

Note that the CLI interface in master also supports building bundles selectively by name.


miracle2k commented Feb 11, 2012

I wonder whether the cache is actually in use, it's taking this long due to the sheer number of files involved that need to be read, and you are really looking for a way to make the CLI build command use force=False, so that timestamps are checked.


miracle2k commented Mar 3, 2012

I'm closing this for now, feel free to reopen if you think the cache is bugged.

miracle2k closed this Mar 3, 2012

rslinckx commented Oct 9, 2012

When introducing the --no-cache option the no_cache parameter is always True or False, but never None.
When the parameter is None, there is some kind of automatic detection based on dependencies defined in the bundle.depends.

Currently using the CLI you either have to use the cache always, or never, but never automatically.

The issue is with sass-style bundles the dependencies are not explicit (as they are resolved by the sass compiler) and thus the cache should not be used because some dependencies might have changed...

Any ideas on how to do this ?


miracle2k commented Oct 11, 2012

I believe this should be fixed in master, via 1e0db6d.

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment