jgable / gulp-cache

A cache proxy task for Gulp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default settings merge files with same content

iliakan opened this issue · comments

The default settings look buggy.

Imagine you have 1.js and 2.js with same content.
The plugin will make the same cache for them.

And will restore them in the single file also (twice 1.js in the stream instead of both). Just checked.

Possible fixes are:

  • include file path into the key by default.
  • do not take file path from the cache (why do we take it anyway?)

Do you think it's common for two different files to have the same contents and need to be treated differently by some tool? Can you give some examples where this would be important?

The defaults are not meant to be exhaustive, just sane.

Ah, I see the paths coming from the cache is more of a bug. Yeah, we shouldn't pull the file path from the cache. If it's available from the stream we should use that.

@jgable maybe it's worth to make settings more explicit - what is to be cached/restored and what's not.

and yes, the visible problem is that it pushes 1.js twice into the stream instead of 1.js and 2.js.

I tried to solve this problem in default-key branch but I'm not enough familiar with the cache implementation of this plugin to fix this issue...

And that's not a question :(

I'm sorry, I just haven't had enough time to put together a test and fix for this. PR's are welcome though if you have time on your own.