Narcissistic Piano Mover
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

gulp-make-css-url-version

0.0.13 • Public • Published

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 gulp-make-css-url-version

Usage

var makeUrlVer = require('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('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('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}
 

install

npm i gulp-make-css-url-version

Downloadsweekly downloads

136

version

0.0.13

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar