{"action":"opened","issue":{"url":"https://api.github.com/repos/w0rm/gulp-svgstore/issues/44","labels_url":"https://api.github.com/repos/w0rm/gulp-svgstore/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/w0rm/gulp-svgstore/issues/44/comments","events_url":"https://api.github.com/repos/w0rm/gulp-svgstore/issues/44/events","html_url":"https://github.com/w0rm/gulp-svgstore/issues/44","id":98548067,"number":44,"title":"Copy sprites svg's attributes into symbols","user":{"login":"ghetolay","id":1864528,"avatar_url":"https://avatars.githubusercontent.com/u/1864528?v=3","gravatar_id":"","url":"https://api.github.com/users/ghetolay","html_url":"https://github.com/ghetolay","followers_url":"https://api.github.com/users/ghetolay/followers","following_url":"https://api.github.com/users/ghetolay/following{/other_user}","gists_url":"https://api.github.com/users/ghetolay/gists{/gist_id}","starred_url":"https://api.github.com/users/ghetolay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghetolay/subscriptions","organizations_url":"https://api.github.com/users/ghetolay/orgs","repos_url":"https://api.github.com/users/ghetolay/repos","events_url":"https://api.github.com/users/ghetolay/events{/privacy}","received_events_url":"https://api.github.com/users/ghetolay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-01T16:25:43Z","updated_at":"2015-08-01T16:25:43Z","closed_at":null,"body":"So following the pull request about namespace, I think we should add the ability to copy some/all attributes from the different sprites into final symbols.\r\n\r\nFirst I think namespace should be left apart and so none of the following will apply to namespace attribute.\r\n\r\nUsing a option seems the best and most flexible way to handle it for most case.\r\nWe could set an option ```copyAttr``` and cover theses values : \r\n\r\n- ```false``` or ```null``` (default) : Behave like now, no attributes are copied except ```viewBox```\r\n- ```true``` : Copy all attributes\r\n- ```array``` (white-list) : Copy attributes whose names are included in the array.\r\n- ```function(AttrName, AttrValue, symbolId)``` : Function is called for each attribute of each sprite and return ```true``` or ```false```.\r\n\r\nNow I don't know what to do about ```viewBox``` in the case of an array : Should it be included on the array or should it be implicitly considered into the white-list and always copied. \r\nIMHO it should be treated as any other attribute and then should be part of the array.\r\n\r\nThe last form using callback is handy because you can create a map to keep track of ```viewBox``` values while returning ```false``` so it won't be copied.\r\nHere is a snippet : \r\n```javascript\r\nvar map = {};\r\ngulp.src('...')\r\n.svgstore({\r\n    copyAttr: function(name, value, id){\r\n        if(name == 'viewBox'){\r\n           map[id] = value\r\n           return false;\r\n        }\r\n        return true;\r\n    }\r\n})\r\n\r\n//inject/update html file with the map\r\n```\r\n"}}