Skip to content

Commit

Permalink
Order files by origPath in order to not replace the comment part(s) o…
Browse files Browse the repository at this point in the history
…f several filenames.
  • Loading branch information
cr0cK committed Apr 29, 2015
1 parent a056e51 commit c2a9e54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions expected/rev-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"images/dummy.jpg": "images/dummy-7051c65f.jpg",
"scripts/application.js": "scripts/application-5c2dec97.js",
"scripts/script.js": "scripts/script-933cb2a0.js",
"styles/styles.css": "styles/styles-270bf21e.css",
"fonts/font1.woff": "fonts/font1-41fe2e1a.woff",
"fonts/font2.woff2": "fonts/font2-1b6441bc.woff2"
"styles/styles.css": "styles/styles-5fff1f5b.css",
"fonts/montserrat-light-webfont.woff": "fonts/montserrat-light-webfont-41fe2e1a.woff",
"fonts/montserrat-light-webfont.woff2": "fonts/montserrat-light-webfont-1b6441bc.woff2"
}
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ module.exports = function override() {
hashedPath: relPath(path.resolve(firstFile.base), file.path),
file: file
});

// sort by filename length to not replace the common part(s) of several filenames
f.sort(function (a, b) {
if(a.origPath.length > b.origPath.length) return -1;
if(a.origPath.length < b.origPath.length) return 1;
return 0;
});
}
cb();
}, function (cb) {
Expand Down

0 comments on commit c2a9e54

Please sign in to comment.