F
F
freeman02042018-09-19 12:23:59
gulp.js
freeman0204, 2018-09-19 12:23:59

How to replace file paths with gulp?

gulp.task('styles', function () {
    return gulp.src(['source/styles/scss/**/*.scss', 'source/include/**/*.scss'])
        .pipe(sass())
        .pipe(remember('styles'))
        .pipe(concat('style.css'))
    
        .pipe(ftp({
            host: '',
            user: '',
            pass: '',
            remotePath: ''
        }));
});

Such a situation, I collect scss on the local, the file has such a path
src: local("Blogger_Sans"), url(../fonts/FiraSansBold/FiraSansBold.ttf);

and on the machine I copy it all to ftp, and there wordpress and the style.css file lies at the root of the theme. And there will already be such a way
src: local("Blogger_Sans"), url(/fonts/FiraSansBold/FiraSansBold.ttf);

Maybe something can be written in the task to change the paths on the fly as I need.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2018-09-19
@freeman0204

https://www.npmjs.com/package/gulp-replace
I think the point is clear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question