O
O
OccamaRazor2016-11-29 10:09:16
gulp.js
OccamaRazor, 2016-11-29 10:09:16

Confused with gulp-svg, how to set it up?

I take files from img svg during processing, they end up in img sprite
Structure:

├── assets                        
│    └── stylus                   
├── built                             
│    ├── css                        
│    ├── fonts                          
│    ├── img  
│          ├── sprite                    
│          └──    svg

gulp:
gulp.task('svg', function () {
    gulp.src('built/img/svg/menu/*.svg')
        .pipe(plumber())
        .pipe(svgMin())
        .pipe(svgSprite({
            "shape": {
                "spacing": {
                    "padding": 5,
                },
            },
            "mode": {
                "css": {
                    "dest": '.',
                    "layout": "diagonal",
                    "sprite": 'sprite.svg', 
                    "bust": false,
                    "prefix" : '$',
                    "dimensions": true,
                    "render": {
                        "styl": {
                            "dest": 'sprite-svg.styl',
                        }
                    }
                }
            }
        }))
        .pipe(plumber.stop())
        .pipe(gulpIf('*.styl', gulp.dest(assets/stylus), gulp.dest(assets/img/sprite)));
});

An error is displayed in the console, css searches and does not find, it turns out that the paths do not match, since the finished css is in built and is looking for 'css' in the same subfolder, how to make it so that there is one valid path?
localhost:8080/built/css/sprite.svg 404 (Not Found)

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