Skip to content

Add gutter option #75

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lozcalver
Copy link

This was simpler than I expected! I haven’t added a test - I’ve never used vitest, so wasn’t really sure where to start.

There’s one notable difference between this and the webpack plugin’s version - I haven’t included the following calculations:

https://github.com/cascornelissen/svg-spritemap-webpack-plugin/blob/775c4b63cb7e2287201d2331544ed677a549ee84/lib/generate-svg.js#L302

As far as I can tell, these calculations adjust the viewBox size on the <view /> elements to add 1/2 the gutter size around the sprite. However, this just results in extra space appearing around the sprite when the -view is used, so I’m not sure why they added this. In my testing it works much better without that additional spacing.

The commit that introduced those calculations is this one: cascornelissen/svg-spritemap-webpack-plugin@6612187. I think it may be a bug that nobody has picked up on because <view /> is used less frequently than <use />.

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

Successfully merging this pull request may close these issues.

1 participant