تطوير الويب
CSS Minify / Beautify
ضغط CSS للإنتاج أو تنسيق CSS المصغّر إلى شكل سهل القراءة.
كبير جدًا للمعاينة
كبير جدًا للمعاينة
Minifying CSS strips whitespace, comments, and line breaks that only exist for human readability and have no effect on how a browser applies styles. The result is a smaller file and a faster page load.
How to use it
- Minify: paste CSS and the tool strips unnecessary whitespace, comments, and line breaks while keeping behavior identical.
- Beautify: paste minified CSS with no indentation to get a readable version back, with indentation and line breaks.
- Handy for quickly reading CSS from a third-party site that only ships a minified version.
Common uses
- Minifying CSS for production when there's no build tool (Vite, Webpack) set up, or for a quick one-off minification.
- Beautifying minified CSS from a third-party library to read or debug it.
- Estimating how much a CSS file will shrink before setting up an automated build.
Things to keep in mind
Minification never changes styling behavior — it's a purely syntactic transformation; if a page looks different after minifying, that's a bug in the tool, not an intentional change.
Without a source map, debugging minified CSS in production is harder — the line numbers shown in the browser console won't match the original file.
مقالة عن هذه الأداة: تصغير CSS: ما الذي يُحذَف فعليًا من الملف ولماذا
الأسئلة الشائعة
ماذا تزيل التصغير فعليًا من CSS الخاص بي؟
يزيل Minify المسافات البيضاء وفواصل الأسطر والتعليقات ويختصر بعض القيم، مما يقلل حجم الملف دون تغيير سلوك CSS.
هل يمكن لـ Beautify استعادة تنسيقي الأصلي بشكل مثالي؟
يعيد Beautify تنسيق CSS المصغّر بمسافات بادئة وفواصل أسطر لتحسين القراءة، لكنه لا يمكنه استعادة التعليقات أو اختيارات الأسلوب الأصلية، لأنها أُزيلت بالفعل أثناء التصغير.
هل التصغير آمن لأي CSS صالح؟
نعم — بالنسبة لـ CSS الصحيح نحويًا، يزيل التصغير فقط الأحرف الزائدة ولا يغيّر أبدًا المحددات أو قيم الخصائص، ويحدث كل شيء محليًا في متصفحك.
هل ما زلت بحاجة إلى التصغير إذا كان الخادم يضغط الملفات بالفعل عبر Gzip؟
نعم — يكمل التصغير وضغط Gzip/Brotli بعضهما بعضًا: يقلّص التصغير الملف المصدري نفسه قبل الضغط، ويضغط Gzip/Brotli النتيجة أكثر أثناء النقل، لذا تنتج التقنيتان معًا حجمًا نهائيًا أصغر من أي منهما بمفردها.
ما هي خريطة المصدر (source map) لـCSS المصغّر؟
خريطة المصدر ملف منفصل يربط أسطر CSS المصغّر بالكود الأصلي المنسّق، مما يتيح لأدوات مطوري المتصفح إظهار أرقام الأسطر وأسماء الملفات الصحيحة أثناء التصحيح، حتى عندما يكون ما يُنشَر فعليًا في الإنتاج هو النسخة المصغّرة.