Comments (4)
Thanks for the ticket, @smessmer. This kind of problem can occur when your pipe to remember()
comes before another pipe that mutates the files. When you rename()
the files, this mutates the file object and thus affects the files in the remember cache.
You can confirm this by putting some logging in node_modules/gulp-remember/index.js
if you are curious. For example,
util.log('REMEMBERING FILE', file.path);
inside thetransform
function.util.log('RECALLING FILE', path, '(' + cache[path].path + ')')
inside theflush
loop.
You'll see that the recalled path inside parens differs from the original path because it was mutated.
There are a few options for you:
- Split apart your processing a little bit and pipe to
gulp.dest('build/resources')
. - Simply swap your pipes to
remember()
andrename()
. This is probably easiest.
In a similar example, you wouldn't want to remember()
a .coffee
file and then send it through the coffeescript transpiler afterward. This would risk re-transpiling an already transpiled file. You would instead transpile it, remember it, then do anything with it that does not require mutating the file, like concatenate with other files, for example.
Let me know if this helps. If so, I'll leave it to you to answer your stack overflow post with the gist of the concept here and the solution that worked for you.
from gulp-remember.
Hey,
thank you for the fast answer :)
Unfortunately, I can't swap remember() and rename(), because remember() is called inside a module and rename() outside of that. Our build is quite complex, using multiple remember caches in different sub modules. And we can't split the build, because in the end, we zip all files together, which needs us to have all files in one stream.
Our current workaround is a check in the rename module that checks whether the resource directory name has already been prepended. That works, but is a (quite hacky) workaround and would not work for other instances (for example when there are input files in a resource/* subfolder that should be copied to resource/resource/* correspondingly).
Is there a specific reason for gulp-remember behaving this way? I'd find it much more logical if it remembered the files as they actually passed through it. Since the output stream of gulp-remember always passes the same future processing, no matter whether it is the first run or a later run, gulp-remember also should output the files in the same way in each run. Later runs should not output different files than the first run remembered.
from gulp-remember.
@ahaurw01 I have some problem. May be add options base
to calculation path.
from gulp-remember.
As mentioned in PR #19, gulp-clone may be a good option here.
from gulp-remember.
Related Issues (15)
- Plugins which compile to different paths won't ever be removed from cache HOT 3
- How to use this with gulp-sourcemaps? HOT 4
- Why use gulp-remember when there is gulp-cached? HOT 4
- Order issue, gulp-order not solving it HOT 1
- After remembering() files are out of order from their original gulp.src HOT 2
- Letter case HOT 5
- Weird behavior - Forgets source Jade files replacing them with compiled HTML HOT 2
- Not piping what passed through, but piping destination files HOT 2
- Checking for changes accross teams HOT 1
- It does not handle files added and removed after run tasks HOT 1
- remember seems to cache HOT 1
- Replace deprecated dependency gulp-util HOT 1
- Strange Behavior on Gulp Remember HOT 4
- expose `caches` to module user HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-remember.