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 83 forks source link

Wrong file.path returned with different `cwd` drive directory under Windows #152

Open hzlzh opened 8 years ago

hzlzh commented 8 years ago

For now, we forked and re-write this for WeFlow use, https://github.com/littledu/weflow-rev-all. @loo2k 's Fix also worked and a PR merge of this should be best.

Since so many PR is not merged, @smysnk do you still support this open repo?

-- Updated --

We are using gulp-rev-all in our Electron App WeFlow, and we found a bug under Windows which can be re-appear like this:

  1. WeFlow.exe is under F:\WeFlow\WeFlow.exe;
  2. Create a f2e project under C:\User\xxx\Dektop\WeFlow_workspace\
  3. Use WeFlow.exe run gulp-rev-all
  4. All the rev-ed file are put in a wrong path: F:\User\xxx\Dektop\WeFlow_workspace\ which should be C:\ not F:\
    • Can you fix that?
    • Also we'd like to know why you change base path into path without C:\?

For more information please check out this screenshot below.

Green block:

base: "C:\Users\....\tmp"
history[0]: "C:\User\....\tmp\css\style-index.css"

Purple Block

cwd: "F:\WeFlow"

Red Block: ( Wrong path, the correct one should be C:\)

path: "F:\Users\....\tmp\css\style-index.37a50e88.css"

error

loo2k commented 8 years ago

I have the same issue. The way to fixed this issue is change tool.js Line 27~31

    var join_path = function (directory, filename) {

        return Path.join(directory, filename).replace(/^[a-z]:\\/i, '/').replace(/\\/g, '/');

    };

to

    var join_path = function (directory, filename) {

        return Path.join(directory, filename).replace(/\\/g, '/');

    };