Asset cache create problems in css compilation #98

endorama opened this Issue Jul 4, 2012 · 3 comments


None yet

3 participants

weLaika member

With assets cache enabled if you include more than one css in the page only one css is returned.

Example of this behaviour:

In _head.haml I have:

= stylesheet_link_tag("bootstrap")
= stylesheet_link_tag("screen")

Both are compiled correctly in the tmp folder, but if I click on bootstrap.css link and on screen.css I get the same file content ( which is the content of the bootstrap.css file, as it comes before the other... )

I found a workaround:
To prevent this behaviour you must DISABLE assets.cache_enabled:

Wordless::set_preference("assets.cache_enabled", false);
weLaika member

The caching system implemented in Wordless create a hash from the concatenation of all sass files found inside the theme/assets/stylesheet folder, so that if one of that files is changed ( regardless of what file it is ) the hash changes and the cache is rebuilt.

To overcome this problem the hash need to be unique for every root sass file, but this means that we must understand which partials are imported in the root sass file, creating the hash with only the content included in the root file.


Would it not be enough for the hash to be unique for each root sass file alone? It should be safe to assume that each root sass file is unique, even if they only contain @import statements. Changing any SASS file would start a recompile which is suboptimal but a lot less work and should fix this bug.

What I am proposing is that we maintain two hashes - a unique hash for each root SASS file, and a hash of all SASS files in the theme. The root hash is used to return the cached_file_path.

I'll work on a pull request.

@STRML STRML added a commit to STRML/wordless that referenced this issue Sep 19, 2012
@STRML STRML Fix for issue #98 and #107. Includes fix for #99. 4b67bb5

We can close this issue.

@Arkham Arkham closed this Nov 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment