Skip to content

Commit

Permalink
fix issues #1
Browse files Browse the repository at this point in the history
Not replacing the hash #1
  • Loading branch information
timtian committed May 11, 2015
1 parent 43b019e commit 7544211
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ module.exports = function (options) {
dateFormat : 'yyyymmddHHMM',
revType:'hash',
transformPath : function (orgPath, rev) {
var newpath = orgPath + (orgPath.indexOf('?') > -1 ? '&':'?') + options.suffix + '=' + rev;
var reg = new RegExp ('((\\?|\\&|\\&amp\\;)' + options.suffix + '=)([^&\\s]+)', 'gi');
var newpath = orgPath;
if(reg.test(orgPath)){
newpath = orgPath.replace(reg, "$1" + rev);
}else{
newpath += ((orgPath.indexOf('?') > -1 ? '&':'?') + options.suffix + '=' + rev);
}
return newpath
},
elementAttributes :{
Expand Down

0 comments on commit 7544211

Please sign in to comment.