w0rm / gulp-svgstore

Combine svg files into one with symbol elements

Home Page:https://www.npmjs.com/package/gulp-svgstore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with globs

sergeymorkovkin opened this issue · comments

Whenever we use a bit more comlex glob patter as compared to plugin example, sprite file naming convention breaks. For example, ./src/globals/sprites/**/*.svg would name all resulting sprites "sprites.svg", since it's the last part before the glob pattern. Therefore, users can only have one sprite with your plugin. I'm using Gulp 4 and not sure about other versions.

As a quick fix I recommend changing this:

fileName = path.basename(file.base)

to this:

fileName = path.basename(path.dirname(file.path))

Hi, I don't want to introduce breaking changes and solve too many use cases that can be addressed using other gulp plugins. I believe that gulp-rename provides the flexibility that you need.

From the readme:

If your workflow is different, please use gulp-rename to rename sources or result.