stitch-gulp-make-css-url-version
v0.0.14
Published
replace version for images in css files
Downloads
2
Maintainers
Readme
gulp-make-css-url-version
a plugin for gulp.js to replace version for images in css files,the version should be file's md5 or time stamp;
Installation
npm install stitch-gulp-make-css-url-version
Usage
var makeUrlVer = require('stitch-gulp-make-css-url-version');
gulp.task('stylesheets', function() {
gulp.src('css/*.css')
.pipe(makeUrlVer())
.pipe(gulp.dest('dist'))
});
Options
useDate :make version with time stamp
var makeUrlVer = require('stitch-gulp-make-css-url-version');
gulp.task('stylesheets', function() {
gulp.src('css/*.css')
.pipe(makeUrlVer({useDate:true}))
.pipe(gulp.dest('dist'))
});
assetsDir: specify the public directory for correct MD5 calculation in some specific cases
var makeUrlVer = require('stitch-gulp-make-css-url-version');
gulp.task('stylesheets', function() {
gulp.src('css/*.css')
.pipe(makeUrlVer({
assetsDir: __dirname + '/public'
}))
.pipe(gulp.dest('dist'))
});
Example
before: index.css
/* loading */
.i-loading{width:32px;height:32px;background:url(../images/loading.gif) no-repeat;}
after: index.css
/* loading */
.i-loading{width:32px;height:32px;background:url(../images/loading.gif?v=Je0sUcMH0mhJPWdZdpHzXg%3D%3D) no-repeat}