Last active
October 8, 2015 20:46
-
-
Save mythmon/aa5d0f1fed55aab8fce0 to your computer and use it in GitHub Desktop.
Simple gulp task to cache bust image urls in css.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'); | |
| var cssImageHash = require('gulp-css-image-hash'); | |
| gulp.task('images', function() { | |
| return gulp.src('./background.png') | |
| .pipe(gulp.dest('./build/')); | |
| }); | |
| gulp.task('css', ['images'], function() { | |
| return gulp.src('./style.css') | |
| .pipe(cssImageHash('build')) | |
| .pipe(gulp.dest('./build/')); | |
| }); | |
| gulp.task('default', ['css']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "gulp-demo", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "dependencies": { | |
| "gulp": "^3.9.0", | |
| "gulp-css-image-hash": "github:d3r/gulp-css-image-hash#44a0c8108d" | |
| }, | |
| "devDependencies": {}, | |
| "author": "", | |
| "license": "MIT" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| background: url('/background.png'); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

The result is
build/style.csscontainining this: