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

Invalidate existing file when it was changed #9

Open
paveliko opened this issue May 18, 2014 · 8 comments
Open

Invalidate existing file when it was changed #9

paveliko opened this issue May 18, 2014 · 8 comments

Comments

@paveliko
Copy link

Hi Steffen,
I use grunt-s3 for publish my build and I use sync with { verify: true } for upload new or changed files only.
Is it possible to invalidate only changed files?

@steffenmllr
Copy link
Member

I've never used grunt-s3 does it provide a list of updated files?

@rainabba
Copy link

rainabba commented Sep 1, 2014

I use aws-s3 (tried s3 and had issues). It does output to console which files are changes, so if it doesn't provide that information in a return somewhere, I suspect it would be fairly trivial to get it. I could use this too.

https://github.com/MathieuLoutre/grunt-aws-s3

@MathieuLoutre
Copy link

grunt-aws-s3 now provides a list of changed files and attaches it to the grunt config variable aws_s3_changed by default. It can be accessed with grunt.config.get('aws_s3_changed').

@ianpogi5
Copy link

ianpogi5 commented Oct 7, 2015

any examples on how to use aws_s3_changed in the gruntfile?

@rantiev
Copy link

rantiev commented Dec 16, 2015

As far as i understand amazon consider wildcard cache invalidation as one invalidation cache request, even if there are thousands files. So if you afraid that you will be charged for 1000 cache invalidation requests while invalidation of folder with 1000 files then no. What goal is there then? Prevention user browser from realoading additional files, that's browser cache problem then, or no?

@ianpogi5
Copy link

@rantiev that's what I ended up doing

@rainabba
Copy link

@rantiev I want to be sure I understand because I think not. Are you suggesting that when one file file has changed, one should invalidate all files?

@eugenioclrc
Copy link

I manage to make it work.

The trick its in creating a dinamyc task.

grunt.registerTask('upload', ['aws_s3:production', 'invalidatedfiles']);

invalidatedfiles its our dinamyc task;

grunt.registerTask('invalidatedfiles', 'Build with production options', function () {
  grunt.config.set('invalidate_cloudfront.production.files', [{
    expand: true,
    cwd: 'your cwd',
    src: grunt.config.get('aws_s3_changed'),
   dest: '',
   filter: 'isFile',
  }]);

  grunt.task.run('invalidate_cloudfront:production');
});

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

7 participants