I need to change the directory that the sprite files are compiled to.
I'm just trying to wrap my head around gulp-svg-sprite for the first time. The goal is to have the scss
file included in my sass
directory, and then compiled with the rest of my partials - this part works fine. However, the generated svg
directory is also put into the sass
directory, so I end up with:
- theme
-- sass
---- _sprites.scss
---- svg
------ sprite.css-58jkdf8js.svg
-- css
---- styles.css
When I actually need this:
- theme
-- sass
---- _sprites.scss
-- css
---- styles.css
---- svg
------ sprite.css-58jkdf8js.svg
Of course, the compile stylesheet has background: url(svg/sprite.css-58adlksjf.svg);
How can I make that sprite directory get compiled under /css
instead of /sass
?
This is the relevant part of gulpfile.js
:
gulp.task('svg', function() {
config = {
mode : {
css : { // Activate the «css» mode
render : {
scss : true // Activate CSS output (with default options)
},
dest : './',
cssFile : "_sprite.scss"
},
symbol : {
dest : '../css/'
}
}
};
gulp.src('src/svg/*.svg')
.pipe(svgSprite(config))
.pipe(gulp.dest('sass'));
})
I only added in the symbol
mode because I was hoping I could just make another copy there, but it just stores it as sprite.symbol.svg
which is not what the CSS is referencing.
I'm thinking an alternative is to forget about sass
for the svg stuff, compile it to /css
and then include another stylesheet. However, that means I would have to include it before the main stylesheet (which right now seems ok, but I haven't thought that part through yet).
Thanks!