build - GulpJS: How to rev images and then update their refs in css files? -


gulp.task('usemin', function () {    return gulp.src(path.src + '*.html')     .pipe(usemin({       assetsdir: 'src',       css: [ minifycss(), 'concat', rev()],       js: [uglify(), rev()],       images: [rev()]     }))     .pipe(gulp.dest(path.dist)); }); 

it not work on images.

the philosophy of gulp-rev-all me way see asset revisioning. it's well explained in readme hash should take account reference(s) between revisioned files.

i've mocked little example minify image , css file use background url property see revision of new image path.

gulp.task('image', function () {   return gulp.src('image.jpeg')     .pipe(img({ progressive: false }))     .pipe(gulp.dest('tmp')); });  gulp.task('css', function () {   return gulp.src('test.css')     .pipe(css())     .pipe(gulp.dest('tmp')); });  gulp.task('rev', ['image', 'css'], function () {   return gulp.src('tmp/**')     .pipe(rev())     .pipe(gulp.dest('dist')); }); 

i've removed fancy stuff more clear, can see whole example here.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -