![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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('.'))
});
### Options
#### default
With no optional parameter sent, the strict mode would false, mode would be type of timestamp.
```js
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('.'))
});
The above task would replace any
<!-- Minified Files -->
<script src="../path/config.min.js?rev=@@hash"></script>
<script src="../path/app.min.js?rev=@@hash"></script>
<script src="../path/serivices.min.js?rev=@@hash"></script>
<!-- Minified Files -->
to below with a hash of timestamp, regardless of file being changed or not:
<!-- Minified Files -->
<script src="../path/config.min.js?rev=1e7aa69df74343571bf4977b685cb496"></script>
<script src="../path/app.min.js?rev=1ed8a9d8c7aa5de44043ca86e9624248"></script>
<script src="../path/serivices.min.js?rev=341a3c405f3445e8a0d908ff1a4542ab"></script>
<!-- Minified Files -->
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('.'))
});
The above task would replace any
```sh
<!-- Minified Files -->
<script src="../path/config.min.js?rev=@@hash"></script>
<script src="../path/app.min.js?rev=@@hash"></script>
<script src="../path/serivices.min.js?rev=@@hash"></script>
<!-- Minified Files -->
to below with a hash of content of file only if the file content has changed:
<!-- Minified Files -->
<script src="../path/config.min.js?rev=51dc1baa4a2dac96097d56de62d860a3"></script>
<script src="../path/app.min.js?rev=7a5a2adc42842b0e2b317440cdc2957f"></script>
<script src="../path/serivices.min.js?rev=46abc154eb09e362ad9ae4f7e69868dc"></script>
<!-- Minified Files -->
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('.'))
});
The above task would replace any
```sh
<!-- Minified Files -->
<script src="../path/config.min.js?rev=@@hash"></script>
<script src="../path/app.min.js?rev=@@hash"></script>
<script src="../path/serivices.min.js?rev=@@hash"></script>
<!-- Minified Files -->
to below with a revision, preferrably coming from svn repo global version also does not check whether the contents of file has been changed or not:
<!-- Minified Files -->
<script src="../path/config.min.js?rev=55"></script>
<script src="../path/app.min.js?rev=55"></script>
<script src="../path/serivices.min.js?rev=55"></script>
<!-- Minified Files -->
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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.