Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
Minify JS with VS code extension

I need: minify JS file with extension from the store, but I can't find an option to remove whitespace between html tags in variables

I use: JS & CSS Minifier (Minify) - https://marketplace.visualstudio.com/items?itemName=olback.es6-css-minify (because I'm lazy to set up a Webpack)

So if input is:

html = `<li class="item">
      <div class="text">
        <p>${array[i]}</p>
      </div>
    </li>`;

Output is only:

s=`<li class="item">\n      <div class="text">\n        <p>${o[r]}</p>\n      </div>\n    </li>`;

The extension uses Terser to minify the code, but I couldn't find any option to remove the whitespace. Thanks for help.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I can't suggest any plugins for you. There may be a limited selection, since this isn't really the proper way to do things, but you seem to realize this.

If you insist on doing this, and can't find a plugin which fits your needs, you can always use CTRL+F with the regular expression (?: |\n):

Ctrl + F, regular expression mode, with regex (?:  |\n)

If you use tabs instead of spaces, then you should be able to replace them with \t.

The catch is that this will obviously replace spaces within your document, but since browsers automatically remove extra spaces, this hopefully shouldn't be an issue.

I would suggest looking into vite. It's a newer and faster alternative to webpack, and I personally find it a lot easier to use and understand.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda