Написать в Max Telegram

Минификатор CSS JS и HTML

Вставьте код — тип определится автоматически. Уберёт комментарии, лишние пробелы и пустые строки, код станет короче, но останется рабочим. Всё в браузере, результат обновляется на ходу.

 

Что делает минификатор

Убирает комментарии, лишние пробелы, переносы строк и пустые строки — то, что нужно человеку для чтения кода, но не нужно браузеру. CSS и HTML сжимаются в одну строку, JS — только по комментариям и отступам (переносы строк между инструкциями сохраняются, подробнее — ниже).

Почему JS сжимается не так агрессивно, как CSS и HTML

У JavaScript есть автоматическая расстановка точек с запятой (ASI): если убрать перенос строки не в том месте, код может начать работать иначе или вовсе сломаться. Минификатор убирает переносы только там, где это доказуемо безопасно — внутри скобок и массивов, сразу после {, (, ;, ,, перед }, ), ], в цепочках вызовов через точку. Там, где перенос может повлиять на смысл (после return, между двумя независимыми выражениями без точки с запятой), он остаётся на месте. Не переименовывает переменные и не удаляет неиспользуемый код — это безопасный компромисс, а не полноценный сборщик уровня Terser или esbuild.

Что не сломается

Минификатор различает код и содержимое строк, шаблонных литералов и регулярных выражений — текст внутри них (в том числе похожий на комментарии или фигурные скобки) не трогается. В CSS отдельно защищены значения url(...), включая base64-картинки, и намеренно не убирается пробел перед :hover и другими псевдоклассами — это может быть частью селектора (.a :hover — это не то же самое, что .a:hover). В HTML содержимое <pre> и <textarea> копируется как есть, а инлайновые <style> и <script> дополнительно сжимаются теми же алгоритмами, что CSS и JS по отдельности.

Как определяется тип кода

Минификатор смотрит на характерные признаки: теги вроде <div> или <!DOCTYPE> — это HTML; правила с фигурными скобками и точкой с запятой после свойства (color: red;), @media и переменные --название — это CSS; ключевые слова вроде function, const, return — JS. Если в поле есть готовый код (не пара символов), тип определяется верно практически всегда.

Сжатие CSS, JS и HTML онлайн — бесплатно

Инструмент нужен перед тем, как выложить код на боевой сайт: меньше байт — быстрее загрузка страницы. Подходит для инлайновых стилей и скриптов, небольших файлов и фрагментов кода, которые не проходят через сборщик. Ничего никуда не отправляется — всё считается в браузере.

You control settings User privacy settings User access controls Used as fallback Use automatic compression Tools for developers To remove whitespace To reduce load Stored in cache Speed and efficiency Security and stability Running on servers Running in production Readability and clarity Optimization without whitespace Minified output preview Minification workflow Minification performance benefits Guidance for optimization Files compressed automatically Compression with gzip Compression and performance Caching and responsiveness Cached on edge Be more efficient Algorithms that boost speed Analysis of resources Artifact is compact enough Artifact with stable checksum Be consistently smaller Behavior is stable Bytes and bandwidth Cached in edge Cached on CDN nodes Caching and responsiveness Can accelerate startup Can decrease footprint Can enhance maintainability Can lower transfer weight Can preserve equivalence Can simplify troubleshooting Clarity and readability Classified as static content Cleanup of formatting Code bundle cleanup Code normalization Code postprocessing Code preprocessing Code refactoring Code sanitization Code simplification Compress assets from repository Compressed but functional Compressed by cssnano Compression and performance Configuration for browsers Control of variables Delivered in milliseconds Delivery is lighter Documentation for users Executed in sandbox Execution is smooth Faster transfer by bundling File byte counter File checksum validation File footprint report Files compressed automatically Files processed locally Files stripped safely Guide for beginners Guidelines for applications Gzip or brotli Handling of requests If compression helps If parsing succeeds It accelerates parsing It cuts overhead It eliminates redundancy It preserves semantics It shortens downloads It simplifies debugging It speeds deployment checks It streamlines maintenance JavaScript beautifier JavaScript compiler JavaScript formatter JavaScript linter JavaScript minifier JavaScript obfuscator JavaScript transformer Latency and throughput Logic and structure Manual or automatic Markup is preserved Minification before release Minification benefits Minification during deployment Minification impact Minification methods Minification options Minification techniques Minification workflow setup Minified script version Minified source output Minify scripts automatically Minify styles quickly More efficient loading More predictable caching More readable output Names and selectors Not required during debugging Not required locally Optimization of assets Optimized by esbuild Output is release ready Page loading optimization Page speed improvement Pages are faster Parsed in worker Patterns that eliminate duplication Pipeline that preserves behavior Processed by uglifier Processing is efficient Reduction of whitespace Reference for teams Removal of comments Remove metadata from source Rendering is quicker Responses are lighter Routines that retain clarity Running on edge nodes Scripts and styles Security and integrity Settings for production Size comparison chart Size metrics dashboard Size reduction metrics Smaller but readable Spacing and indentation Speed and delivery stability Speed and efficiency Stored as compressed stream Stored in memory Strip whitespace from input Support for automation Systems that lower overhead The application The asset pipeline The browser The browser payload The build pipeline The command The compression workflow The compressor The developer The engine The function The interface The library The module The optimization pipeline The optimizer The output The parser The process The project The resource The response The script The server The source The stylesheet The template The workflow These optimizations matter This reduces footprint This streamlines maintenance This trims clutter This workflow lowers latency To accelerate To automate To clean To combine To compress To convert To improve To optimize To prepare To preserve To reduce To remove To shorten To simplify To transform Transfer is faster Transfers are efficient Transformed in pipeline Treated as intermediate form Use automated tooling Utilities that streamline transmission Validation of syntax When compression finishes When parsing begins With automatic stripping With brotli support With gzip encoding Workflow that lowers transfer weight You lower transfer weight You preserve runtime semantics You review changes Your dashboard Your frontend Your repository Your runtime payload Your workspace
Показать