Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not test for duplicate icons #99

Open
betsydupuis opened this issue May 9, 2015 · 5 comments
Open

Does not test for duplicate icons #99

betsydupuis opened this issue May 9, 2015 · 5 comments

Comments

@betsydupuis
Copy link

It is possible to produce duplicate svgs specifying files with the same name in different directories

gruntfile.js

    svgstore: {
      defaults: {
        options: {
        },
        files: {
          'tmp/default_options.svg': ['test/fixtures/codepen.svg',
                                                     'test/fixtures/remote/codepen.svg']
        },
      },

Result SVG

<svg xmlns="http://www.w3.org/2000/svg">
    <symbol viewBox="0 0 100 100" id="codepen">
        <title>Codepen Icon</title>
        <desc>This is the offical Codepen icon</desc>
        ...
    </symbol>
    <symbol viewBox="0 0 100 100" id="codepen">
        <title>Codepen Icon</title>
        <desc>This is the offical Codepen icon</desc>
        ...
    </symbol>
</svg>
@IanLunn
Copy link

IanLunn commented Jun 16, 2015

On running the task multiple times, it'll also add the same icon to the output file each time. Should it clear the output file before adding definitions again?

@betsydupuis
Copy link
Author

Maybe output an error?

Another away to deal with it would be for:

        files: {
          'tmp/default_options.svg': ['test/fixtures/codepen.svg',
                                                     'test/fixtures/remote/codepen.svg']
        },

To output:

<svg xmlns="http://www.w3.org/2000/svg">
    <symbol viewBox="0 0 100 100" id="codepen">
        <title>Codepen Icon</title>
        <desc>This is the offical Codepen icon</desc>
        ...
    </symbol>
   <!------- Add the remote directory as prepended part of the name/id ------->
    <symbol viewBox="0 0 100 100" id="remote-codepen">
        <title>Remote Codepen Icon</title>
        <desc>This is the offical Codepen icon</desc>
        ...
    </symbol>
</svg>

A real world example would be attempting to compile two icon sets into one sprite sheet. Personally, I'm maintaining legacy icons while trying to minify the icon set.

@Samic8
Copy link

Samic8 commented Jul 6, 2015

The thing is that although the files may be of the same name, generating the same ID. They could be completely different svgs, which the naming being the only similarity. I am thinking the error message might be the best way to deal with it.

@betsydupuis
Copy link
Author

@Samic8 Yes, I think an error output would accommodate most situations.

@biser-yordanov
Copy link

Just proposed a possible solution, which works for a project of mine with Pull Request #143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants