Skip to content

Commit

Permalink
Merge pull request #110 from STRML/master
Browse files Browse the repository at this point in the history
Fix for hashing issue with multiple SASS or CoffeeScript files. Fixes #107, #98
  • Loading branch information
stefanoverna committed Sep 19, 2012
2 parents 463fa33 + 4a60db7 commit dd48f89
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions wordless/preprocessors/compass_preprocessor.php
Expand Up @@ -44,6 +44,8 @@ protected function asset_hash($file_path) {
foreach ($files as $file) {
$hash_seed[] = $file . date("%U", filemtime($file));
}
// Concat original file onto hash seed for uniqueness so each file is unique
$hash_seed[] = $file_path;
return md5(join($hash_seed));
}

Expand Down
2 changes: 2 additions & 0 deletions wordless/preprocessors/less_preprocessor.php
Expand Up @@ -39,6 +39,8 @@ protected function asset_hash($file_path) {
foreach ($files as $file) {
$hash_seed[] = $file . date("%U", filemtime($file));
}
// Concat original file onto hash seed for uniqueness so each file is unique
$hash_seed[] = $file_path;
return md5(join($hash_seed));
}

Expand Down
2 changes: 2 additions & 0 deletions wordless/preprocessors/sprockets_preprocessor.php
Expand Up @@ -40,6 +40,8 @@ protected function asset_hash($file_path) {
foreach ($files as $file) {
$hash_seed[] = $file . date("%U", filemtime($file));
}
// Concat original file onto hash seed for uniqueness so each file is unique
$hash_seed[] = $file_path;
return md5(join($hash_seed));
}

Expand Down
4 changes: 2 additions & 2 deletions wordless/preprocessors/wordless_preprocessor.php
Expand Up @@ -92,12 +92,12 @@ protected function comment_line($line) {
*
*/
protected function asset_hash($file_path) {
// First we get the file content
// First we get the file's modified date
$hash_seed = date("%U", filemtime($file_path));

// Then we attach the preferences
foreach ($this->preferences_defaults as $pref => $value) {
$hash_seed .= $pref . '=' . $this->preference($pref) . ';';
$hash_seed .= $pref . '=' . (is_array($this->preference($pref)) ? implode(" ", $this->preference($pref)) : $this->preference($pref)) . ';';
}

return md5($hash_seed);
Expand Down

0 comments on commit dd48f89

Please sign in to comment.