Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins which compile to different paths won't ever be removed from cache #1

Closed
brian-mann opened this issue Apr 25, 2014 · 3 comments

Comments

@brian-mann
Copy link

Scenario:

You have a bunch of .coffee files.

During the build process you transpile those to .js and then you remember() them. Since you're remembering the transpiled versions, their path will be altered from path/to/file/foo.coffee to path/to/file/foo.js.

Then when you delete that file, the lookup for the path will not find the path/to/file/foo.js since that's not the original path name. So in other words, after you delete your source file, it will continue to be pulled back in and never actually removed.

This will happen for any file when the original extension changes during the build process.

@ahaurw01
Copy link
Owner

Good find! You're definitely right; the forget api has no knowledge of how the file path may have been altered by other plugins.

I'm not sure addressing this problem is within the scope of what this plugin aims to achieve. I imagine to solve this problem you're keeping track in your watcher callback of what files may have a different path in the remember cache? E.g. if the path ends in .coffee, pass .js instead to forget?

Curious what thoughts you have on how this could be addressed in a generic manner.

@brian-mann
Copy link
Author

I'm still working this into my build process, so I think I'll come up with a better idea.

For now I forked gulp-remember and simply stripped off the extension when caching and deleting from the cache (since that works for my specific use cases).

Still thinking about it though.

@ahaurw01
Copy link
Owner

I don't think I'm comfortable with merging the fix you have for this, as there could be files with the same path but different extensions within your source. For example, /some/path/component-1.js and /some/path/component-1.css.

As I think about it more, taking care of passing the correct path to forget as files are deleted should probably be taken care of outside of this plugin.

If you think of some messaging or suggestions to add to the readme as a warning for this case, by all means shoot it my way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants