Answer the question
In order to leave comments, you need to log in
SvgSprite gulp how to correctly write the path from the root?
.pipe(svgSprite({
mode: {
symbol: {
sprite: "../sprite.svg",
render: {
scss: {
dest: "C:/Users/User/Desktop/gulp/src/style/partials/sprite.scss",
template: "./bower_components/sprite/sprite_template.scss"
}
}
}
}
}))
../../../src/style/partials/
TypeError: Cannot read property 'sockets' of undefined
C:/Users/User/Desktop/gulp/src/style/partials/sprite.scss
Answer the question
In order to leave comments, you need to log in
Instead of writing an absolute path, use __dirname if necessary.
I have it organized a little differently:
var src = {
svgsprite: ['./src/img/icons/sprites/*.svg']
},
gulp.task('svgsprite', function() {
return gulp.src(src.svgsprite)
.pipe(svgSprite(config = {
preview: false,
selector: "icon-%f",
cssFile: "_svgsprite.scss",
svg: {
sprite: "img/sprite.svg"
},
dimension : {
maxWidth : 32,
maxHeight : 32
},
baseSize: 32
}))
.pipe(gulp.dest('./src/sass'))
.pipe(connect.reload())
});
gulp.task('svgsprite-clean', function (cb) {
del(['./src/sass/img/sprite.svg','./src/sass/_svgsprite.scss'], cb);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question