RevealTheme logo

Minificador de JavaScript

Minificação básica de JavaScript: remove comentários e espaços em branco desnecessários. Use um minificador real (Terser, esbuild) para produção.

Como usar esta ferramenta

  1. 1

    Paste or type your JavaScript into the input textarea.

  2. 2

    The minified output appears instantly in the panel below as you type — there is no button to press.

  3. 3

    Check the size readout (original length, an arrow, and minified length) to see how much was removed.

  4. 4

    Select the text in the output box and copy it manually into your file.

O que é o Minificador de JavaScript?

A minificação de JavaScript reduz o tamanho do pacote e o tempo de análise. Esta ferramenta realiza uma remoção básica de espaços em branco e comentários. Para pacotes de produção, use Terser, esbuild ou SWC: eles fazem ofuscação de nomes e eliminação de código morto que produz uma saída drasticamente menor (muitas vezes entre 60% e 80% de redução).

Casos de uso comuns

  • Quickly shrinking a short, comment-heavy snippet before pasting it into a tight inline <script> tag.

  • Stripping comments out of a code sample to share a compact version in a chat or gist.

  • Estimating roughly how much comment and whitespace overhead a small file carries before setting up a real build.

  • Cleaning up a hand-written configuration object or constant block that has no strings containing slashes.

  • Demonstrating to students or teammates what basic comment and whitespace removal looks like versus a real compiler.

  • Minifying a tiny utility function for a bookmarklet where pulling in a full toolchain is overkill.

Perguntas frequentes

Como ele se compara ao Terser?
O Terser é muito mais agressivo: ofuscação de nomes, eliminação de código morto, etc. Esta ferramenta apenas remove comentários e espaços em branco.
Isso vai quebrar meu código?
Só se o seu JS tiver problemas de sintaxe (pontos e vírgulas faltando em posições ambíguas). O JavaScript moderno é seguro.

Ferramentas relacionadas