w0rm / gulp-svgstore

Combine svg files into one with symbol elements
https://www.npmjs.com/package/gulp-svgstore
645 stars 33 forks source link

Path concatenation example doesn't work #75

Closed olabaloo closed 7 years ago

olabaloo commented 7 years ago

The example provided to concatenate relative paths, e.g. src/svg/one/two/three/circle.svg to one-two-three-circle, doesn't work.

When I print path.sep to the console, gulp says it is undefined.

Example:

var gulp = require('gulp');
var rename = require('gulp-rename');
var svgstore = require('gulp-svgstore');

gulp.task('default', function () {
    return gulp
        .src('src/svg/**/*.svg', { base: 'src/svg' })
        .pipe(rename(function (path) {
            console.log(path.sep);                   // undefined
            var name = path.dirname.split(path.sep);
            name.push(path.basename);
            path.basename = name.join('-');
        }))
        .pipe(svgstore())
        .pipe(gulp.dest('dest'));
});
w0rm commented 7 years ago

Hi! Sorry for the late reply, yeah, I confused a path function argument and a path module that has path.sep

w0rm commented 7 years ago

I updated the Readme.