ข้ามไปที่เนื้อหา

นับการเปิดหน้าและการคลิกโปรเจกต์ด้วย PostHog (เซิร์ฟเวอร์ EU) ไหม โหลดเมื่อคุณกดอนุญาตเท่านั้น ความเป็นส่วนตัว

Minifier live preview
โปรเจกต์ทั้งหมด

Minifier

Minify HTML, CSS, or JS without setting up a build pipeline.

Minifying a quick code snippet for embedding required build tooling just for a one-off task.

Tech Domain · Book Dev|เผยแพร่แล้ว|หลักฐาน: ใช้งานจริง|Next.js, TypeScript

มี deployment สาธารณะที่เปิดให้ทดลองใช้งาน

กรณีศึกษา

ก่อนใช้งาน

Quickly minifying code snippets for embedding or testing required build tooling setup. Online minifiers were slow, ad-heavy, or didn't support all web languages.

หลังใช้งาน

The page minifies a snippet in the browser and shows the source size, output size, and percentage saved.

วิธีแก้ปัญหา

Built a client-side minifier, now at /minifier in the Devtools Workbench suite, for HTML, CSS, JavaScript, and JSON. JSON is re-serialized with JSON.parse; the others use simple comment and whitespace stripping. It shows before/after size and copies the output.

สิ่งที่ยังไม่แก้

CSS, HTML, and JS use regex stripping, not a real parser, so unusual code (for example strings containing //) can break, and there is no renaming or dead-code removal.

บทความที่เกี่ยวข้อง

อ่านเพิ่มเติมในหัวข้อที่เกี่ยวข้องจากบล็อก

โปรเจกต์ที่เกี่ยวข้อง

เพิ่มเติมใน Tech Domain · Book Dev