D
D
Denis Karakchiev2019-06-05 10:50:25
JavaScript
Denis Karakchiev, 2019-06-05 10:50:25

JS caching in browsers - is gulp-rev needed and how to get the filename processed by it?

TLDR; How can I store the filename output by gulp-rev into a variable? Or maybe browsers do not cache scripts as styles and this is not really necessary at all?
---
On one project there is processing of gulp-rev scripts and writing names in manifest.json. There was a need to take the file name after processing by the plugin (ie all-e03c3a6f80.min.js, for example) in order to use it in another gulp task.
Now I'm taking the name of this file from json through the usual fs.readFileSync, JSON.parse() and all that.
But due to the confusion of the config and the lack of time to put it in order - now it will not be possible to fix the errors (due to which this manifest.json does not appear at the right time).
That. this approach does not work properly.
So the question arose - does the browser cache scripts the way it caches styles (where the constant reversion of the file name is clearly justified) - i.e., is it necessary at all? And if necessary, how to get the filename that gulp-rev produces in the context of executing gulp tasks?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question