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

Please provide a cache option #11

Closed
bolord opened this issue Feb 2, 2015 · 2 comments
Closed

Please provide a cache option #11

bolord opened this issue Feb 2, 2015 · 2 comments

Comments

@bolord
Copy link

bolord commented Feb 2, 2015

Hello! I'm using this plugin to add some data for gulp-swig.

This plugin has a cache for readed files?
Why when I changed data files, same content in return like first time?

@bolord
Copy link
Author

bolord commented Feb 2, 2015

I found answer, it's require() cache.

My solution:

gulp.task('json-test', function() {
  return gulp.src('./examples/test1.html')
    .pipe(data(function(file) {
      var json = './examples/' + path.basename(file.path) + '.json';
      delete require.cache[require.resolve(json)];
      return require(json);
    }))
    .pipe(swig())
    .pipe(gulp.dest('build'));
});

@bolord bolord closed this as completed Feb 2, 2015
@maniqui
Copy link

maniqui commented Jun 25, 2015

@bolord thanks for coming back and posting your solution, as I was looking a way to clean the cache on gulp-data.

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