minify icon indicating copy to clipboard operation
minify copied to clipboard

Force minify file with unsupported extension

Open zefir-git opened this issue 3 years ago • 3 comments
trafficstars

I was surprised to find out that minify refuses to minify .ejs files (which essentially are HTML) and I assume this is determined by the file extension, as the file Content-Type is text/html.

It would be particularly handy to be able to force minify a file, i.e. by providing the type with an additional argument. For instance

minify index.ejs --type html
minify file --type js

etc.

Do let me know if I shall make a PR.

zefir-git avatar Dec 25 '21 20:12 zefir-git

This is amazing idea for a Pull Request :)! minify should definitely support ejs, and other unknown files according to passed type.

coderaiser avatar Dec 26 '21 08:12 coderaiser

I see that in help the arguments --html, --css and --js are already supported. Should I use these?

zefir-git avatar Dec 26 '21 09:12 zefir-git

I see that in help the arguments --html, --css and --js are already supported. Should I use these?

Yes, it runs minifying according to supported types

coderaiser avatar Dec 26 '21 09:12 coderaiser

Use:

cat index.ejs | minify --html

Or since v10.1.0:

cat index.ejs | minify --auto

coderaiser avatar May 24 '23 15:05 coderaiser