S
S
sergemin2017-11-03 08:48:57
HTML
sergemin, 2017-11-03 08:48:57

What is wrong with adding svg?

Unable to style svg
My gulp to build sprites

gulp.task('svgstore', function () {
    return gulp
        .src('app/svg/parts/*.svg')
        .pipe(svgmin(function (file) {
            let prefix = path.basename(file.relative, path.extname(file.relative));
            return {
                plugins: [{
                    cleanupIDs: {
                        prefix: prefix + '-',
                        minify: true
                    }
                }]
            }
        }))
        .pipe(svgstore())
    .pipe(rename({basename: 'sprite'}))
        .pipe(gulp.dest('app/svg/build'));
});

The code I am adding to the html
<svg class="icon">
                <use xlink:href="/svg/build/sprite.svg#facebook"></use>
            </svg>

I even removed the style attribute with the specified fill value from the svg file
Tell me what I'm doing wrong. Or, if possible, show your approach
. Basically, I googled about sprites and their settings in gulp.
In the latter, I didn’t like the fact that for compatibility they include a library that is written in jquery, and then I will have to include jquery, even though the project planned on pure js

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question