{"action":"created","issue":{"url":"https://api.github.com/repos/cascornelissen/svg-spritemap-webpack-plugin/issues/37","repository_url":"https://api.github.com/repos/cascornelissen/svg-spritemap-webpack-plugin","labels_url":"https://api.github.com/repos/cascornelissen/svg-spritemap-webpack-plugin/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/cascornelissen/svg-spritemap-webpack-plugin/issues/37/comments","events_url":"https://api.github.com/repos/cascornelissen/svg-spritemap-webpack-plugin/issues/37/events","html_url":"https://github.com/cascornelissen/svg-spritemap-webpack-plugin/issues/37","id":329949894,"node_id":"MDU6SXNzdWUzMjk5NDk4OTQ=","number":37,"title":"Add svg dimensions to sprite object","user":{"login":"galymax","id":1148423,"node_id":"MDQ6VXNlcjExNDg0MjM=","avatar_url":"https://avatars0.githubusercontent.com/u/1148423?v=4","gravatar_id":"","url":"https://api.github.com/users/galymax","html_url":"https://github.com/galymax","followers_url":"https://api.github.com/users/galymax/followers","following_url":"https://api.github.com/users/galymax/following{/other_user}","gists_url":"https://api.github.com/users/galymax/gists{/gist_id}","starred_url":"https://api.github.com/users/galymax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galymax/subscriptions","organizations_url":"https://api.github.com/users/galymax/orgs","repos_url":"https://api.github.com/users/galymax/repos","events_url":"https://api.github.com/users/galymax/events{/privacy}","received_events_url":"https://api.github.com/users/galymax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-06T16:48:55Z","updated_at":"2018-06-08T09:59:01Z","closed_at":null,"author_association":"NONE","body":"When using the svg sprite in sass as background, the container dimensions or background size need to be used to scale the svg. Often the svg needs to be used in ins original dimensions, so it would be really helpful to be able to access these in sass. Could you consider changing the generated sprite object like so:\r\n\r\n```\r\n$sprites: (\r\n    'mySVG': (\r\n\tsvg: \"data:image/svg+xml,%3csvg xmlns...\",\r\n\twidth: 14.5,\r\n\theight: 5\r\n   )\r\n);\r\n```\r\n\r\nThe mixin would need to be changed like so:\r\n\r\n```\r\n@mixin sprite($name) {\r\n    $obj: map-get($sprites, $name);\r\n    $sprite: map-get($obj, svg);\r\n    background: url($sprite) center no-repeat;\r\n}\r\n```\r\n\r\nThat would add the possibility to overwrite the mixin with a custom one that uses the original dimensions of the svg:\r\n\r\n```\r\n@mixin sprite($name) {\r\n    $obj: map-get($sprites, $name);\r\n    $sprite: map-get($obj, svg);\r\n    background: url($sprite) center no-repeat;\r\n    background-size: map-get($obj, width)px map-get($obj, height)px;\r\n}\r\n```\r\n\r\nYou could also consider adding an optional parameter to the mixin that sets the svg to it's original size.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/cascornelissen/svg-spritemap-webpack-plugin/issues/comments/395713358","html_url":"https://github.com/cascornelissen/svg-spritemap-webpack-plugin/issues/37#issuecomment-395713358","issue_url":"https://api.github.com/repos/cascornelissen/svg-spritemap-webpack-plugin/issues/37","id":395713358,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTcxMzM1OA==","user":{"login":"cascornelissen","id":1304939,"node_id":"MDQ6VXNlcjEzMDQ5Mzk=","avatar_url":"https://avatars2.githubusercontent.com/u/1304939?v=4","gravatar_id":"","url":"https://api.github.com/users/cascornelissen","html_url":"https://github.com/cascornelissen","followers_url":"https://api.github.com/users/cascornelissen/followers","following_url":"https://api.github.com/users/cascornelissen/following{/other_user}","gists_url":"https://api.github.com/users/cascornelissen/gists{/gist_id}","starred_url":"https://api.github.com/users/cascornelissen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cascornelissen/subscriptions","organizations_url":"https://api.github.com/users/cascornelissen/orgs","repos_url":"https://api.github.com/users/cascornelissen/repos","events_url":"https://api.github.com/users/cascornelissen/events{/privacy}","received_events_url":"https://api.github.com/users/cascornelissen/received_events","type":"User","site_admin":false},"created_at":"2018-06-08T09:59:01Z","updated_at":"2018-06-08T09:59:01Z","author_association":"OWNER","body":"Thanks for the feature request, sounds like a great thing to add. The only problem I'm seeing is that the solution provided by @galymax (rewriting the `$sprites` variable) would be backwards incompatible.\r\n\r\nWe could either think of a different setup, maybe involving a separate `$sizes` variable or holding on to this for a `3.x` release which I'm planning either way as I would love to refactor the current options setup."}}
{"actor":{"display_login":"cascornelissen"}}