[feature req] minifier fails if input folder contains anything else than html files
See original GitHub issueHi!
If there are images in the input directory, html-minifier
breaks. For example, I use npm script task:
html-minifier --input-dir ./test1 --output-dir ./test2 --html-5 --collapse-whitespace
There is only 1 html file and 1 png image in the folder test1/
.
I get the following error:
Minification error on test1/test-icon.png
Parse Error: <����O��... (and goes on)...
I’d like to use html-minifier
to minify my static website’s output folder — it contains everything that normal website would contain, including images.
If there is a temporary solution to feed only .html files from the folder into html-minifier
, please advise as well, I’m keen to minify all my .html files.
Thank you.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
npm scripts: need to minify all HTML files in folder (and ...
npm library minimize works only on per-file but not on folders. I need this to minify my static website's HTML files. Grunt and...
Read more >Applying minification to all files in a directory · Issue #734
I'm trying to apply html-minifier to all files inside a directory (recursively). I wasn't able to figure out how to do it.
Read more >How to Minify JavaScript — Recommended Tools and ...
First, you'll copy and paste your JavaScript source code or upload the source code file on the tool. Then, you'll optimize the minification ......
Read more >How to Minify Your Website's CSS, HTML & Javascript
We minify the files of a website containing CSS, HTML, and Javascript code so your web browser can read them faster. Here is...
Read more >Bundling and Minification
NET 4.5 that makes it easy to combine or bundle multiple files into ... that includes all the appropriate (that is debug or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Updated the title. I’ll see what I can do 😃
I have a Hugo-diven static website and I want to run the minifier on the whole
/public/
folder — everything that is generated by Hugo. It’s necessary because HTML partials often have spaces everywhere, what adds up when rendered and looks clearly computer-generated with ten spaces, opening<div>
, twenty spaces and fifteen line breaks, then some text…Thanks again for sorting folder recursion + filtering by extension in v3.0.1, I really appreciate that!