{"id":2276,"date":"2017-10-31T17:21:37","date_gmt":"2017-10-31T09:21:37","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2276"},"modified":"2017-10-31T17:21:37","modified_gmt":"2017-10-31T09:21:37","slug":"svgr-%e7%ae%80%e4%bb%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2276","title":{"rendered":"svgr \u7b80\u4ecb"},"content":{"rendered":"<p>\n\t\u767e\u5ea6\u641c\u7d22\u4e86\u4e00\u4e0b <a href=\"https:\/\/www.xttblog.com\/?tag=SVGR\" name=\"svgr\" target=\"_blank\" title=\"svgr\">SVGR<\/a> \uff0c\u7ed3\u679c\u6ca1\u641c\u7d22\u5230\u4e00\u6761\u76f8\u5173\u7684\u5185\u5bb9\u3002\u56e0\u6b64\u6211\u51b3\u5b9a\u5199\u4e00\u7cfb\u5217\u5173\u4e8e <a href=\"https:\/\/www.xttblog.com\/?tag=SVGR\" name=\"svgr\" target=\"_blank\" title=\"svgr\">SVGR<\/a> \u6559\u7a0b\u7684\u6587\u7ae0\uff0c\u672c\u6587\u662f\u7b2c\u4e00\u7bc7\uff0c<a href=\"https:\/\/www.xttblog.com\/?tag=SVGR\" name=\"svgr\" target=\"_blank\" title=\"svgr\">SVGR<\/a> \u5165\u95e8\u7b80\u4ecb\u7bc7\u3002\n<\/p>\n<p>\n\t<a href=\"https:\/\/www.xttblog.com\/?tag=svgr\" name=\"svgr\" target=\"_blank\" title=\"svgr\">svgr<\/a> \u662f\u4e00\u4e2a\u5c06SVG\u8f6c\u6362\u4e3aReact\u7ec4\u4ef6\uff0c<a href=\"https:\/\/www.xttblog.com\/?tag=svgr\" name=\"svgr\" target=\"_blank\" title=\"svgr\">svgr<\/a> \u7531 JavaScript \u5b9e\u73b0\u3002\u6574\u4e2a\u6587\u6863\u4e5f\u975e\u5e38\u7684\u5c0f\uff0c\u76ee\u524d\u6700\u65b0\u7248\u672c\u4e3av0.5.0\uff0c\u5df2\u5f00\u6e90\u5728github\u4e0a\u3002\n<\/p>\n<p>\n\t<a href=\"https:\/\/www.xttblog.com\/?tag=svgr\" name=\"svgr\" target=\"_blank\" title=\"svgr\">svgr<\/a> \u5b98\u7f51\u5730\u5740\uff1a<a href=\"https:\/\/github.com\/smooth-code\/svgr\" name=\"svgr\" target=\"_blank\" title=\"svgr\">https:\/\/github.com\/smooth-code\/svgr<\/a>\u3002\u622a\u6b62\u53d1\u7a3f\u524d\uff0c<a href=\"https:\/\/www.xttblog.com\/?tag=svgr\" name=\"svgr\" target=\"_blank\" title=\"svgr\">svgr<\/a> \u5df2\u83b7\u5f97\u4e0a\u5343\u7684 star\u3002\n<\/p>\n<p>\n\t<a href=\"https:\/\/www.xttblog.com\/?tag=svgr\" name=\"svgr\" target=\"_blank\" title=\"svgr\">svgr<\/a> \u5305\u542b\u4e00\u4e0b\u6838\u5fc3\u5173\u952e\u8bcd\uff1asvg2react\u3001svg-to-react\u3001svg\u3001svgo\u3001react\u3001react-svg\u3001react-svg-creator\u3001svg-react\u3001webpack-loader\u3001webpack\u3001inline-svg\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"svgr\" src=\"http:\/\/ocuzluml6.bkt.clouddn.com\/svgr-logo.png\" style=\"width: 1000px;height: 1000px\" \/>\n<\/p>\n<h2>\n\t\u5b89\u88c5svgr<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\nnpm install svgr<\/pre>\n<h2>\n\t\u57fa\u672c\u7528\u6cd5<br \/>\n<\/h2>\n<p>\n\t\u770b\u4e00\u4e2aicon.svg\u4f8b\u5b50\uff1a\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n&lt;svg width=&quot;48px&quot; height=&quot;1px&quot; viewBox=&quot;0 0 48 1&quot; version=&quot;1.1&quot; \r\nxmlns=&quot;http:\/\/www.w3.org\/2000\/svg&quot; xmlns:xlink=&quot;http:\/\/www.w3.org\/1999\/xlink&quot;&gt;\r\n    &lt;!-- Generator: Sketch 46.2 (44496) - http:\/\/www.bohemiancoding.com\/sketch --&gt;\r\n    &lt;title&gt;Rectangle 5&lt;\/title&gt;\r\n    &lt;desc&gt;Created with Sketch.&lt;\/desc&gt;\r\n    &lt;defs&gt;&lt;\/defs&gt;\r\n    &lt;g id=&quot;Page-1&quot; stroke=&quot;none&quot; stroke-width=&quot;1&quot; fill=&quot;none&quot; fill-rule=&quot;evenodd&quot;&gt;\r\n        &lt;g id=&quot;19-Separator&quot; transform=&quot;translate(-129.000000, -156.000000)&quot; fill=&quot;#063855&quot;&gt;\r\n            &lt;g id=&quot;Controls\/Settings&quot; transform=&quot;translate(80.000000, 0.000000)&quot;&gt;\r\n                &lt;g id=&quot;Content&quot; transform=&quot;translate(0.000000, 64.000000)&quot;&gt;\r\n                    &lt;g id=&quot;Group&quot; transform=&quot;translate(24.000000, 56.000000)&quot;&gt;\r\n                        &lt;g id=&quot;Group-2&quot;&gt;\r\n                            &lt;rect id=&quot;Rectangle-5&quot; x=&quot;25&quot; y=&quot;36&quot; width=&quot;48&quot; height=&quot;1&quot;&gt;&lt;\/rect&gt;\r\n                        &lt;\/g&gt;\r\n                    &lt;\/g&gt;\r\n                &lt;\/g&gt;\r\n            &lt;\/g&gt;\r\n        &lt;\/g&gt;\r\n    &lt;\/g&gt;\r\n&lt;\/svg&gt;<\/pre>\n<p>\n\t\u8fd0\u884cSVGR\uff1a\n<\/p>\n<pre class=\"brush:bash;\">\r\nsvgr --no-semi --icon --replace-attr-value &quot;#063855=currentColor&quot; icon.svg<\/pre>\n<p>\n\t\u6700\u540e\u88ab\u8f6c\u6362\u6210\u4e86React \u4ee3\u7801\uff1a\n<\/p>\n<pre class=\"brush:jscript;\">\r\nimport React from &quot;react&quot;\r\n\/\/ \u4e1a\u4f59\u8349\uff1bwww.xttblog.com\r\nconst SvgComponent = props =&gt; (\r\n  &lt;svg width=&quot;1em&quot; height=&quot;1em&quot; viewBox=&quot;0 0 48 1&quot; {...props}&gt;\r\n    &lt;path d=&quot;M0 0h48v1H0z&quot; fill=&quot;currentColor&quot; fillRule=&quot;evenodd&quot; \/&gt;\r\n  &lt;\/svg&gt;\r\n)\r\nexport default SvgComponent<\/pre>\n<p>\n\t<a href=\"https:\/\/www.xttblog.com\/?tag=svgr\" name=\"svgr\" target=\"_blank\" title=\"svgr\">svgr<\/a> \u8fd8\u6709\u5f88\u591a\u5f00\u7bb1\u5373\u7528\u7684\u529f\u80fd\uff0c\u6211\u4eec\u4e0b\u7ae0\u518d\u8bf4\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2276\">svgr \u7b80\u4ecb<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u767e\u5ea6\u641c\u7d22\u4e86\u4e00\u4e0b SVGR \uff0c\u7ed3\u679c\u6ca1\u641c\u7d22\u5230\u4e00\u6761\u76f8\u5173\u7684\u5185\u5bb9\u3002\u56e0\u6b64\u6211\u51b3\u5b9a\u5199\u4e00\u7cfb\u5217\u5173\u4e8e SVGR \u6559\u7a0b\u7684\u6587\u7ae0\uff0c\u672c\u6587\u662f\u7b2c [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[1106,373,52,1563],"class_list":["post-2276","post","type-post","status-publish","format-standard","hentry","category-html5","tag-javascript","tag-react","tag-svg","tag-svgr"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2276"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2276\/revisions"}],"predecessor-version":[{"id":2277,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2276\/revisions\/2277"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}