V
V
Vladislav Khvostov2016-09-20 12:29:59
Node.js
Vladislav Khvostov, 2016-09-20 12:29:59

How to overwrite a file with gulp?

It is necessary to optimize and store svg in the sources.
Planned to use gulp-svgmin

gulp.task('svg-minify', function () {
    return gulp.src('logo.svg')
        .pipe(svgmin())
        .pipe(gulp.dest('logo.svg'));
});

The problem is that if you try to write to the same file, the node crashes with an error.
```
Error: EEXIST: file already exists, mkdir '/home/khvostov/app/logo.svg'
```
Please tell me what to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Khvostov, 2016-09-20
@vlakhvo

stackoverflow.com/questions/22418799/can-gulp-over...
gulp.task('svg-minify', function () {
return gulp.src('logo.svg')
.pipe(svgmin())
.pipe (gulp.dest('./'));
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question