smysnk / gulp-rev-all

Static asset revisioning with dependency considerations, appends content hash to each filename (eg. unicorn.css => unicorn.098f6bcd.css), re-writes references.
https://www.npmjs.org/package/gulp-rev-all
MIT License
422 stars 88 forks source link

rev keywords #199

Open littledu opened 5 years ago

littledu commented 5 years ago

I have an index.js file that exists in below code:

for(var i=0;i<allDots.length;i++){
        allDots[i].addEventListener("click",function(){
            var index= [].indexOf.call(allDots, this);
            bannerTl.seek("index"+(index+1));
        })
    }

After compilation, the code becomes:

for(var i=0;i<allDots.length;i++){
        allDots[i].addEventListener("click",function(){
            var index= [].indexOf.call(allDots, this);
            bannerTl.seek("index.f22f6e73"+(index+1));
        })
    }

bannerTl.seek("index"+(index+1)); -> bannerTl.seek("index.f22f6e73"+(index+1));

so sad!, how can I solve it?

pioug commented 5 years ago

@littledu Thanks for reporting the bug. Unfortunately there is a whole branch for handling "extensionless" references to JS files 🙈 https://github.com/smysnk/gulp-rev-all/blob/master/revisioner.js#L62. I went a bit in the commit history and I think the purpose is solving references when using CommonJS. Maybe you can play with some settings https://github.com/smysnk/gulp-rev-all#dontupdatereference to ignore index.js?

        { dontUpdateReference: ["index.js"] }

But it's gonna ignore actual references to index.js 🙈 I don't know enough about this project to propose a patch.