Created
August 2, 2016 09:36
Convert CSS background image paths to Shopify asset paths
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 $ = require('gulp-load-plugins')(); | |
var replace = require('gulp-replace'); | |
var rename = require("gulp-rename"); | |
/* | |
Gulp task to convert CSS background image paths to Shopify asset urls, | |
e.g. url(/images/background.jpg) -> url({{ 'background.jpg' | asset_url }}) | |
*/ | |
gulp.task('fixurls', function(){ | |
gulp.src(['css/app.css']) | |
.pipe(replace(/url\(\/?images\/(.+)\)/g, 'url({{ \'$1\' | asset_url }})')) | |
.pipe(rename("style.css.liquid")) | |
.pipe(gulp.dest('./css')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment