GitXplorerGitXplorer
t

gulp-rev-mtime

public
16 stars
12 forks
3 issues

Commits

List of commits on branch master.
Unverified
47254d6ad2e73371258aeaea7948be53caae9f2f

Deprecate plugin in README

committed 10 years ago
Unverified
e21b33ecc5ea43b22e32d9051c87dd5b0916dc7e

Release v0.0.4

committed 10 years ago
Unverified
a03bfe756006b4a499df93dc8c8aa8246a1da979

Merge pull request #6 from gtfiorentino/skip_cdn

committed 11 years ago
Unverified
ba38db2cd61c8e5e1940244d565517265555bfba

Skip element if '//' in reference

committed 11 years ago
Unverified
8bc1e919ed8b429bd6f7b105d6ea0ef44e36eb0d

[Fix #3] Skip processing the element if no src attribute is found

committed 11 years ago
Unverified
b98435fd25acb38b2530b4eb509bb33fdec56b16

[Fix #4] Remove Gulp dependency in package.json

committed 11 years ago

README

The README file for this repository.

gulp-rev-mtime

Appends a file's modified UNIX timestamp to a file URL to cache assets

DEPRECATED

This Gulp plugin is deprecated. Please use https://github.com/sindresorhus/gulp-rev instead for a much more robust solution.

Install

npm install --save-dev gulp-rev-mtime

Examples

Default

This example will take the example.html file and add rev tags to all files that are found in this file, with default options.

var gulp = require('gulp');
var rev = require('gulp-rev-mtime');

gulp.task('rev', function () {
	gulp.src('template.html')
		.pipe(rev())
		.pipe(gulp.dest('.'));
});

Input:

<link rel="stylesheet" href="main.min.css"/>

<script src="abc.js"></script>
<script src="def.js"></script>

Output:

<link rel="stylesheet" href="main.min.css?v=1393322652000">

<script src="abc.js?v=1393321191000"></script>
<script src="def.js?v=1393321187000"></script>

Custom options

This example will take the example.html file and add rev tags to all files that are found in this file with the custom options provided.

var gulp = require('gulp');
var rev = require('gulp-rev-mtime');

gulp.task('rev', function () {
	gulp.src('template.html')
		.pipe(rev({
		  'cwd': 'public/assets',
		  'suffix': 'rev',
		  'fileTypes': ['css']
		}))
		.pipe(gulp.dest('.'));
});

Input:

<link rel="stylesheet" href="main.min.css"/>

<script src="abc.js"></script>
<script src="def.js"></script>

Output:

<link rel="stylesheet" href="main.min.css?rev=1393322652000">

<script src="abc.js"></script>
<script src="def.js"></script>

API

rev(options)

options.cwd

Type: String
Default: ''

Acts as a working directory for your assets, if your assets are not located in the root folder of the opened file.

options.suffix

Type: String
Default: 'v'

The name of the query parameter for versioning. Example: <script src="https://raw.githubusercontent.com/thomastuts/gulp-rev-mtime/master/def.js?v=1393321187000"></script>

options.fileTypes

Type: Array
Default: ['js', 'css']

You can choose which files to add version tags to. Use this option if you only want to add version tags to specific file types.

License

MIT © Thomas Tuts