![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
gulp-rev-timestamp
Advanced tools
$ npm install --save gulp-rev-timestamp
This plugin is based on gulp-rev-append which is very good and in some cases even better, because it relies on file hash, so if file didn't change between versions, the hash will remain the same so file can stay in cache.
gulp-rev-timestamp provides you an option to either read your file and generate a hash out of it what rev-append does or just generate a hash(timestamp or revision) and replace the query string every time regardless of file being changed or not. This way regardless of file contents changes or not, you have a new query string every time appended to file. This is bit faster than the first option, as it does not require to read the contents of file every time and generate a hash based on it.
var FILE_DECL = /(?:href=|src=|url\()['|"]([^\s>"']+?)\?rev=([^\s>"']+?)['|"]/gi;
We can use gulp-rev-timestamp to cache-bust several assets and generate timestamp or hash or revision.
var gulp = require('gulp');
var revts = require('gulp-rev-timestamp');
gulp.task('rev-timestamp', function() {
gulp.src("index.html")
.pipe(revts())
.pipe(gulp.dest('.'))
});
With no optional parameter sent, the strict mode would false, mode would be type of timestamp.
var gulp = require('gulp');
var revts = require('gulp-rev-timestamp');
gulp.task('rev-timestamp', function() {
gulp.src("index.html")
.pipe(revts({strict: true}))
.pipe(gulp.dest('.'))
});
Type : Boolean
Default: false
You set a flag, strict, which will check if the file exist in relative path and also generate a hash and append to query string only if file content has changed. Default value is false
.
var gulp = require('gulp');
var revts = require('gulp-rev-timestamp');
gulp.task('rev-timestamp', function() {
gulp.src("index.html")
.pipe(revts({strict: true}))
.pipe(gulp.dest('.'))
});
Type : String
Default: timestamp
Specifies the type of hash you would like to append to your query string (timestamp or revision)
var gulp = require('gulp');
var revts = require('gulp-rev-timestamp');
gulp.task('rev-timestamp', function() {
gulp.src("index.html")
.pipe(revts({strict: false, mode: 'timestamp'}))
.pipe(gulp.dest('.'))
});
When mode => revision
var gulp = require('gulp');
var revts = require('gulp-rev-timestamp');
gulp.task('rev-timestamp', function() {
gulp.src("index.html")
.pipe(revts({strict: false, mode: 'revision', revision: '55'}))
.pipe(gulp.dest('.'))
});
MIT © [Vinoth Babu]
FAQs
Appends a timestamp to query string
The npm package gulp-rev-timestamp receives a total of 191 weekly downloads. As such, gulp-rev-timestamp popularity was classified as not popular.
We found that gulp-rev-timestamp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.