lazd/gulp-replace

Clarification on specifying file path to look at in gulp.src for this tool

Closed this issue · 1 comments

Hi I've looked at your examples and am a bit confused as to what goes where on a css url string replace.

My attempt is as so

const fontURL = function () {
        //path of file to target i.e. fonts.css
	return gulp.src(['../site/fractal/components/preview/fonts.css'])
        //in fonts.css replace all instances of /assets/fonts/ with ./
	.pipe(replace('/assets/fonts/', './'))
        // save file back in directory 
	.pipe(gulp.dest('../site/fractal/components/preview/'));
}

I am confused because on your object string example what I think I'm doing seems to be reversed. Can you confirm this is the proper usage for replaces portions of a string in a file?

lazd commented

That is precisely the example that's documented here. https://github.com/lazd/gulp-replace/blob/master/examples/inplace/gulpfile.js