Sublime Forum

How to unminify HMTL file

#1

Hi
I have a html file wich contain html, css and javascript but all is in one line. I guess the file is minify.

Is there a way, with Sublime, to format the to be able read it?

I tried Edit -> Line -> Reindent without success

Do I need to install a apckage to do it? Which would you recommand me?

Then I will have the same question, after I modified the code, is there a way, with Sublime, to minify it? Or would it be realy necessary to minify it?

A similar question, if I have a html file, a css file in css folder, and some javascript in js folder. Does Sublime would be able to read all files and minify it in one file?

I am working with LeafLet library which has css and js file, and when all is done, I want to have all in one file…

Many thanks

0 Likes

#2

If this is a one-off task and you don’t need to do this repeatedly, you might find it quicker to use an online parser:

Prettier v3.6.2

(make sure you choose the HTML parser from the dropdown)

If you want to build this sort of capability into your ST workflow, I would recommend this package:

HTML-CSS-JS Prettify - Packages - Package Control

Ensure that you follow the setup instructions as you have to install some dependancies, such as node.js.

If you then need to re-minify the file at the end of it all, you could try any of these (however depending on what you intend to do with the code, this may be unnecessary):

0 Likes

#3

Many thanks for your help
Prettler is very usefull for what I need for now.

However, I tried to install Minofy without success. May be I have a problem with my Sublime verison

When I press command+shift+p, and then I type “install package”, I have choose

Then I can not see how I can install Minify or Minifier, etc

0 Likes

#4

Do you have ‘Package Control’ installed? If not, follow these ‘first time’ instructions:
Installation - Package Control

Or, you could simply use this online minifier:
Minify JS / CSS - JavaScript and CSS Minifier / Compressor

0 Likes

#5

Built-in Package Control installer still installs Package Control 3, which does no longer work on MacOS version for years.

Please refer to the very first (pinned) topic for this issue:

0 Likes

#6

oops, my bad - sorry. I guess I’ve been using ST so long that the last time I needed to install package control was the old way.

0 Likes