{"id":26038,"date":"2024-11-24T09:21:49","date_gmt":"2024-11-24T01:21:49","guid":{"rendered":"https:\/\/fwq.ai\/blog\/26038\/"},"modified":"2024-11-24T09:21:49","modified_gmt":"2024-11-24T01:21:49","slug":"%e4%bd%bf%e7%94%a8-webpack-%e6%89%93%e5%8c%85%e5%90%8e%ef%bc%8c%e5%b0%be%e9%83%a8-windcss-%e7%b1%bb%e5%90%8d%e6%b2%a1%e6%9c%89%e8%a2%ab%e6%89%93%e5%8c%85%ef%bc%8c%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/26038\/","title":{"rendered":"\u4f7f\u7528 Webpack \u6253\u5305\u540e\uff0c\u5c3e\u90e8 windcss \u7c7b\u540d\u6ca1\u6709\u88ab\u6253\u5305\uff0c\u5982\u4f55\u89e3\u51b3\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173077979044613.jpg\" class=\"aligncenter\" title=\"\u4f7f\u7528 Webpack \u6253\u5305\u540e\uff0c\u5c3e\u90e8 windcss \u7c7b\u540d\u6ca1\u6709\u88ab\u6253\u5305\uff0c\u5982\u4f55\u89e3\u51b3\uff1f\u63d2\u56fe\" alt=\"\u4f7f\u7528 Webpack \u6253\u5305\u540e\uff0c\u5c3e\u90e8 windcss \u7c7b\u540d\u6ca1\u6709\u88ab\u6253\u5305\uff0c\u5982\u4f55\u89e3\u51b3\uff1f\u63d2\u56fe\" \/><\/p>\n<p>\u4f7f\u7528 webpack \u6253\u5305\u540e\uff0c\u5c3e\u90e8 wind \u7684\u7c7b\u540d\u6ca1\u6709\u88ab\u6253\u5305\u7684\u95ee\u9898\uff0c\u53ef\u4ee5\u901a\u8fc7\u5728 tlwind.config.js \u4e2d\u914d\u7f6e purge \u9009\u9879\u6765\u89e3\u51b3\u3002<\/p>\n<p>purge \u9009\u9879\u53ef\u4ee5\u6307\u5b9a\u8981\u5206\u6790\u7684 html \u6587\u4ef6\uff0c\u4ee5\u4fbf tailwindcss \u53ef\u4ee5\u63d0\u53d6\u6240\u6709\u4f7f\u7528\u7684\u7c7b\u540d\u5e76\u5c06\u5176\u5305\u542b\u5728\u6700\u7ec8 css \u6587\u4ef6\u4e2d\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5c06 index.html \u548c header.html \u6587\u4ef6\u6dfb\u52a0\u5230 purge \u6570\u7ec4\u4e2d\u3002<\/p>\n<p>\u4fee\u6539\u540e\u7684 tailwind.config.js \u6587\u4ef6\u53ef\u80fd\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>module.exports = {\n  purge: ['index.html', 'src\/base\/*.html'], \/\/ \u65b0\u589e index.html \u548c src\/base\/*.html\n  darkMode: false,\n  theme: {\n    extend: {},\n  },\n  variants: {\n    extend: {},\n  },\n  plugins: [],\n};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u6dfb\u52a0\u8fd9\u4e9b\u6587\u4ef6\uff0ctailwindcss \u73b0\u5728\u5c06\u5206\u6790\u5b83\u4eec\uff0c\u5e76\u5c06\u4efb\u4f55\u4f7f\u7528\u7684\u7c7b\u540d\u5305\u542b\u5728\u6253\u5305\u7684 css \u6587\u4ef6\u4e2d\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4f7f\u7528 Webpack \u6253\u5305\u540e\uff0c\u5c3e\u90e8 wind \u7c7b\u540d\u6ca1\u6709\u88ab\u6253\u5305\uff0c\u5982\u4f55\u89e3\u51b3\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 webpack \u6253\u5305\u540e\uff0c\u5c3e\u90e8 wind \u7684\u7c7b\u540d\u6ca1\u6709\u88ab\u6253\u5305\u7684\u95ee\u9898\uff0c\u53ef\u4ee5\u901a\u8fc7\u5728 tlwind.config.js \u4e2d\u914d\u7f6e purge \u9009\u9879\u6765\u89e3\u51b3\u3002 purge \u9009\u9879\u53ef\u4ee5\u6307\u5b9a\u8981\u5206\u6790\u7684 html \u6587\u4ef6\uff0c\u4ee5\u4fbf tailwindcss \u53ef\u4ee5\u63d0\u53d6\u6240\u6709\u4f7f\u7528\u7684\u7c7b\u540d\u5e76\u5c06\u5176\u5305\u542b\u5728\u6700\u7ec8 css \u6587\u4ef6\u4e2d\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5c06 index.html \u548c header.html \u6587\u4ef6\u6dfb\u52a0\u5230 purge \u6570\u7ec4\u4e2d\u3002 \u4fee\u6539\u540e\u7684 tailwind.config.js \u6587\u4ef6\u53ef\u80fd\u5982\u4e0b\u6240\u793a\uff1a module.exports = { purge: [&#8216;index.html&#8217;, &#8216;src\/base\/*.html&#8217;], \/\/ \u65b0\u589e index.html \u548c src\/base\/*.html darkMode: false, theme: { extend: {}, }, variants: { extend: {}, }, plugins: [], }; \u767b\u5f55\u540e\u590d\u5236 \u901a\u8fc7\u6dfb\u52a0\u8fd9\u4e9b\u6587\u4ef6\uff0ctailwindcss \u73b0\u5728\u5c06\u5206\u6790\u5b83\u4eec\uff0c\u5e76\u5c06\u4efb\u4f55\u4f7f\u7528\u7684\u7c7b\u540d\u5305\u542b\u5728\u6253\u5305\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-26038","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=26038"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26038\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=26038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=26038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=26038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}