{"id":337219,"date":"2024-01-29T22:59:27","date_gmt":"2024-01-29T14:59:27","guid":{"rendered":"https:\/\/www.idc.net\/help\/337219\/"},"modified":"2024-01-29T22:59:27","modified_gmt":"2024-01-29T14:59:27","slug":"%e5%bc%80%e6%ba%90%e7%9a%84%e5%9c%a8%e7%ba%bf%e5%9b%be%e7%89%87%e5%8e%8b%e7%bc%a9%e5%b7%a5%e5%85%b7-squoosh","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/337219\/","title":{"rendered":"\u5f00\u6e90\u7684\u5728\u7ebf\u56fe\u7247\u538b\u7f29\u5de5\u5177-Squoosh"},"content":{"rendered":"<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u8bf4\u5230\u56fe\u7247\u538b\u7f29\uff0c\u5927\u90e8\u5206\u4eba\u5e94\u8be5\u90fd\u77e5\u9053<\/span><span style=\"color: #F14668\">tinypng<\/span>\u8fd9\u4e2a\u5728\u7ebf\u56fe\u7247\u538b\u7f29\u5de5\u5177\uff0c\u4e0d\u5f97\u4e0d\u8bf4\uff0c\u8fd9\u8d27\u7684\u538b\u7f29\u8d28\u91cf\u8fd8\u633a\u4e0d\u9519\u7684\u3002\u800c\u4e14\uff0c\u6211\u4e5f\u7ecf\u5e38\u7528\u5230\u5b83\u3002\u524d\u51e0\u5929\uff0c\u6211\u8981\u538b\u7f29\u51e0\u5f20\u81ea\u5df1\u7684\u7167\u7247\u7528\u4e8e\u7535\u5b50\u8bf7\u67ec\uff0c\u4e0d\u60f3\u628a\u8fd9\u4e9b\u79c1\u6709\u56fe\u7247\u4e0a\u4f20\u5230\u522b\u4eba\u7684\u7f51\u7ad9\u4e0a\uff0c\u5c31\u60f3\u7740\u627e\u4e2a\u5f00\u6e90\u7684\u3002\u6700\u7ec8\u8fd8\u771f\u627e\u5230\u4e00\u4e2a\u975e\u5e38\u4e0d\u9519\u7684\u5f00\u6e90\u56fe\u7247\u5728\u7ebf\u538b\u7f29\u5de5\u5177-<span style=\"color: #F14668\">squoosh\u3002<\/span><\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s6.\/oss\/202206\/14\/75c17c014d691bbb7550497dae630aa336abbd.png\" style=\"width: 895px;height: 527px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #F14668\">squoosh<\/span>\u5728\u538b\u7f29\u56fe\u7247\u65f6\uff0c\u90fd\u662f\u5728\u672c\u5730\u6267\u884c\uff0c\u4e0d\u4f1a\u5c06\u56fe\u7247\u4e0a\u4f20\u5230\u670d\u52a1\u7aef\uff0c\u8fd9\u6837\u5c31\u4fdd\u969c\u4e86\u7528\u6237\u9690\u79c1\u5b89\u5168\u3002\u4f46\u662f\uff0cSquoosh\u7528\u5230\u4e86\u8c37\u6b4c\u5206\u6790\u5de5\u5177\uff0c\u4f1a\u6536\u96c6\u4e00\u4e9b\u57fa\u7840\u4fe1\u606f\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s6.\/oss\/202206\/14\/85cc04578568634ba757186f8fc8c813307619.jpg\" style=\"width: 1138px;height: 884px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u5982\u679c\u8fde\u57fa\u7840\u4fe1\u606f\u4f60\u4e5f\u4ecb\u610f\u7684\u8bdd\uff0c\u53cd\u6b63\u4ee3\u7801\u5728\u4f60\u624b\u4e0a\uff0c\u60f3\u600e\u4e48\u5e72\u5c31\u770b\u4f60\u81ea\u5df1\u4e86\u3002<\/span><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u6211\u4eec\u53bbGithub\u628a\u4ee3\u7801\u4e0b\u8f7d\u4e0b\u6765\uff0c\u89e3\u538b\u6e90\u4ee3\u7801\uff0c\u8fdb\u5165\u5230\u6e90\u7801\u6839\u76ee\u5f55\uff0c\u5b89\u88c5\u4f9d\u8d56\u5305\u3002<\/span><\/p>\n<pre><span style=\"margin: 0px;padding: 0px\">npm<\/span> <span style=\"margin: 0px;padding: 0px\">install<\/span><\/pre>\n<p><span style=\"color: #4A4A4A\"><span style=\"background-color: #F5F5F5\">\u5b89\u88c5\u8fc7\u7a0b\u53ef\u80fd\u4f1a\u56e0\u4e3a\u7f51\u7edc\u539f\u56e0\u5b89\u88c5\u5931\u8d25\uff0c\u8fd9\u91cc\u662f\u7528<\/span><\/span><span style=\"color: #F14668\"><span style=\"background-color: #F5F5F5\">nrm<\/span><\/span><span style=\"background-color: #F5F5F5\">\u6765\u66ff\u6362\u955c\u50cf\u6e90\u3002<\/span><\/p>\n<p><span style=\"color: #4A4A4A\">\u7136\u540e\u6267\u884c\u7f16\u8bd1\u3002<\/span><\/p>\n<pre><span style=\"margin: 0px;padding: 0px\">npm<\/span> <span style=\"margin: 0px;padding: 0px\">run<\/span> <span style=\"margin: 0px;padding: 0px\">build<\/span><\/pre>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s9.\/oss\/202206\/14\/b7d8e8d744379c49cc80532f812a127d406bda.jpg\" style=\"width: 1162px;height: 380px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u6700\u540e\uff0c\u6267\u884c\u8fd0\u884c\u547d\u4ee4\uff1a<\/span><\/p>\n<pre><span style=\"margin: 0px;padding: 0px\">npm<\/span> <span style=\"margin: 0px;padding: 0px\">run<\/span> <span style=\"margin: 0px;padding: 0px\">dev<\/span><\/pre>\n<p><span style=\"color: #4A4A4A\">\u56e0\u4e3a\u6211\u7528\u7684\u662fWindows\uff0c\u6267\u884c<\/span><span style=\"color: #F14668\">npm run dev<\/span>\u4f1a\u62a5\u9519\uff0c\u6240\u4ee5\uff0c\u5c31\u4fee\u6539\u4e86<span style=\"color: #F14668\">package.json<\/span>\u7684\u5185\u5bb9\uff0c\u5c06:<\/p>\n<pre><span style=\"margin: 0px;padding: 0px\">\"scripts\"<\/span>: {<br>   <span style=\"margin: 0px;padding: 0px\">\"build\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"rollup -c &amp;&amp; node lib\/move-output.js\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"debug\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"node --inspect-brk node_modules\/.bin\/rollup -c\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"dev\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"DEV_PORT=\\\"${DEV_PORT:=5000}\\\" run-p watch serve\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"watch\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"rollup -cw\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"serve\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"serve --listen=$DEV_PORT --config ..\/..\/..\/serve.json .tmp\/build\/static\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"prepare\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"husky install\"<\/span><br> },<\/pre>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u6539\u4e3a:<\/span><\/p>\n<pre><span style=\"margin: 0px;padding: 0px\">\"scripts\"<\/span>: {<br>   <span style=\"margin: 0px;padding: 0px\">\"build\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"rollup -c &amp;&amp; node lib\/move-output.js\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"debug\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"node --inspect-brk node_modules\/.bin\/rollup -c\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"dev\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\" run-p watch serve\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"watch\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"rollup -cw\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"serve\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"serve --listen=5000 --config ..\/..\/..\/serve.json .tmp\/build\/static\"<\/span>,<br>   <span style=\"margin: 0px;padding: 0px\">\"prepare\"<\/span>: <span style=\"margin: 0px;padding: 0px\">\"husky install\"<\/span><br> },<\/pre>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u5982\u679c\u662f<\/span><span style=\"color: #F14668\">Linux<\/span><span style=\"color: #4A4A4A\">,\u5219\u4e0d\u9700\u8981\u505a\u5982\u4e0a\u7684\u8c03\u6574\u3002<\/span><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u73b0\u5728\u6267\u884c\u8fd0\u884c\u547d\u4ee4:<\/span><\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s7.\/oss\/202206\/14\/6459d20817facda28e0077b175752bcbae51ff.jpg\" style=\"width: 1234px;height: 1286px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u542f\u52a8\u6210\u529f\u540e\uff0c\u6d4f\u89c8\u5668\u8bbf\u95ee<\/span><span style=\"color: #F14668\">http:\/\/127.0.0.1:5000<\/span>\uff0c\u5c31\u53ef\u4ee5\u5f00\u59cb\u538b\u7f29\u56fe\u7247\u4e86\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s8.\/oss\/202206\/14\/76de73f451739092395821c7eb09636eb9075e.png\" style=\"width: 1899px;height: 999px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u8fd9\u91cc\uff0c\u6211\u968f\u4fbf\u627e\u4e00\u56fe\u7247\u539f\u56fe\u5927\u5c0f\u4e3a<\/span><span style=\"color: #F14668\">776KB<\/span>\u7684<span style=\"color: #F14668\">png<\/span>\u56fe\u7247\u538b\u7f29\u5e76\u8f6c\u6362\u4e3ajpg\u540e\u7684\u5927\u5c0f\u4e3a<span style=\"color: #F14668\">101KB\u3002<\/span><\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s9.\/oss\/202206\/14\/054377b4383d5bddf408402a11de8617b2ac92.png\" style=\"width: 1918px;height: 1004px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u5f53\u7136\uff0c\u8fd9\u91cc\u7684\u8f6c\u6362\u683c\u5f0f\u548c\u538b\u7f29\u8d28\u91cf\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u6765\u8c03\u6574\u7684\u3002\u901a\u8fc7\u7f51\u9875\u7684\u65b9\u5f0f\uff0c\u6211\u4eec\u53ef\u4ee5\u4e00\u5f20\u5f20\u7684\u8fdb\u884c\u538b\u7f29\uff0c\u5982\u679c\u6211\u4eec\u538b\u7f29\u7684\u56fe\u7247\u8f83\u591a\u65f6\uff0c\u8fd9\u6837\u7684\u64cd\u4f5c\u6548\u7387\u5c31\u6709\u4e9b\u4f4e\u4e86\uff0c\u5176\u5b9e\uff0c<\/span><span style=\"color: #F14668\">Squoosh<\/span>\u8fd8\u63d0\u4f9b\u4e86<span style=\"color: #F14668\">API<\/span>\u548c\u5ba2\u6237\u7aef\u547d\u4ee4\u6765\u6279\u91cf\u538b\u7f29\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s4.\/oss\/202206\/14\/33110cf152301b2aa91833687cd268d86ea935.png\" style=\"width: 1098px;height: 480px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s4.\/oss\/202206\/14\/63ef08e273817ff633b91323b8ebf5bbc6b5dd.png\" style=\"width: 1023px;height: 470px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #4A4A4A\">\u6709\u5174\u8da3\u7684\uff0c\u53ef\u4ee5\u6309\u7167Github\u4e2d\u7684\u8bf4\u660e\u5b89\u88c5\u4e0b\u6765\u5c1d\u8bd5\u4e00\u4e0b\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf4\u5230\u56fe\u7247\u538b\u7f29\uff0c\u5927\u90e8\u5206\u4eba\u5e94\u8be5\u90fd\u77e5\u9053tinypng\u8fd9\u4e2a\u5728\u7ebf\u56fe\u7247\u538b\u7f29\u5de5\u5177\uff0c\u4e0d\u5f97\u4e0d\u8bf4\uff0c\u8fd9\u8d27\u7684\u538b\u7f29\u8d28\u91cf\u8fd8\u633a\u4e0d\u9519\u7684\u3002\u800c\u4e14\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":337220,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-337219","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/337219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=337219"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/337219\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/337220"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=337219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=337219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=337219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}