{"action":"closed","issue":{"url":"https://api.github.com/repos/ahaurw01/gulp-remember/issues/18","labels_url":"https://api.github.com/repos/ahaurw01/gulp-remember/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/ahaurw01/gulp-remember/issues/18/comments","events_url":"https://api.github.com/repos/ahaurw01/gulp-remember/issues/18/events","html_url":"https://github.com/ahaurw01/gulp-remember/issues/18","id":110981633,"number":18,"title":"Adds file back to the stream with wrong path (i.e. path changes that happened after gulp-remember are already applied)","user":{"login":"smessmer","id":2373925,"avatar_url":"https://avatars.githubusercontent.com/u/2373925?v=3","gravatar_id":"","url":"https://api.github.com/users/smessmer","html_url":"https://github.com/smessmer","followers_url":"https://api.github.com/users/smessmer/followers","following_url":"https://api.github.com/users/smessmer/following{/other_user}","gists_url":"https://api.github.com/users/smessmer/gists{/gist_id}","starred_url":"https://api.github.com/users/smessmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smessmer/subscriptions","organizations_url":"https://api.github.com/users/smessmer/orgs","repos_url":"https://api.github.com/users/smessmer/repos","events_url":"https://api.github.com/users/smessmer/events{/privacy}","received_events_url":"https://api.github.com/users/smessmer/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-12T14:07:34Z","updated_at":"2015-11-21T19:40:48Z","closed_at":"2015-11-21T19:40:48Z","body":"[Using gulp 3.9.0, gulp-cached 1.1.0, gulp-remember 0.3.0, gulp-rename 1.2.2]\r\n[stackoverflow post: http://stackoverflow.com/questions/33072113/gulp-remember-seems-to-output-wrong-path]\r\n\r\nWe're using gulp as a build tool and gulp-cached together with gulp-remember to allow fast incremental rebuilds. Part of the files under build have to be moved to a different output directory and this has to happen in-stream (i.e. not in gulp.dest()), because we're zipping the results afterwards. We use gulp-rename for this.\r\n\r\nHowever, when the build script is called multiple times (gulp.watch() for incremental rebuilds), then it seems to apply the gulp-rename transformation multiple times. It looks like gulp-remember is not actually outputting the files with the path it saw them last time, but with the path they got after the gulp-rename step.\r\n\r\nI've narrowed the problem down to the following script:\r\n\r\n    var gulp = require('gulp');\r\n    var cached = require('gulp-cached');\r\n    var remember = require('gulp-remember');\r\n    var rename = require('gulp-rename');\r\n    \r\n    function build() {\r\n        gulp.src(\"src/**\")\r\n            .pipe(cached())\r\n            .pipe(remember())\r\n            .pipe(rename(function(path) {path.dirname = \"resources/\" + path.dirname;}))\r\n            .pipe(gulp.dest('build/'));\r\n    }\r\n    \r\n    gulp.task('default', [], function() {\r\n        build();\r\n        build();\r\n    });\r\n\r\nRunning this on a source directory src with just one file \"myfile.js\" produces the output file:\r\n\r\n    /build/resources/resources/myfile.js\r\n\r\nIf the second call to build() is removed, it produces correctly\r\n\r\n    /build/resources/myfile.js\r\n\r\nAnd if we insert a third call to build(), it produces\r\n\r\n    /build/resources/resources/resources/myfile.js\r\n\r\nI think gulp-remember should output the files with the path they had when they passed through it last time, not the path the files got after being processed further."}}