Error on overwriting file with minified content
See original GitHub issueI’d like to use this tool in my CD pipeline to overwrite a simple HTML file I have for a site. However, using the same input & output throws an error and does not succeed.
➜ start_page git:(master) ✗ npx minify static/index.html > static/index.html
npx: installed 25 in 2.483s
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
assert(data)
at AsyncFunction.module.exports [as html] (/home/x/.npm/_npx/48208/lib/node_modules/minify/lib/html.js:38:5)
at onDataRead (/home/x/.npm/_npx/48208/lib/node_modules/minify/lib/minify.js:75:44)
at optimize (/home/x/.npm/_npx/48208/lib/node_modules/minify/lib/minify.js:61:18)
at async minify (/home/x/.npm/_npx/48208/lib/node_modules/minify/lib/minify.js:35:12)
at async Promise.all (index 0) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: '',
expected: true,
operator: '=='
}
As this is the very last step in a deploy I really have no need to keep the original, unminified version around, so overwriting is ideal. As of now I have to write, remove the original, and then rename the minified version, which is a bit of an annoyance.
I’ll take a look myself, see if I can’t get something together to resolve this.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Gulp js cssmin issue. Can't overwrite existing minified files
UPD: After removing the bootstrap-theme.min.css, the error is caused by another one. Conclusion: the task can't overwrite the existing min.css ...
Read more >Avoiding Common Implementation Mistakes
The following scenarios represent some of the most common mistakes observed when implementing GPT. While such implementations may appear to ...
Read more >CSS/JS Issues | Troubleshooting | LSCache for WordPress
Troubleshooting JavaScript, CSS, and other page optimization issues in the LiteSpeed Cache for WordPress Plugin.
Read more >Ignoring Code - ESLint - Pluggable JavaScript Linter
You can configure ESLint to ignore certain files and directories while ... '!<relative/path/to/filename>'") to override ✖ 1 problem (0 errors, 1 warning).
Read more >How to Overwrite a File in Python? (5 Best Methods with Code)
If the file contains any content, it will be completely overwritten by anything you write on the opened file. All the previous data...
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
This is actually an issue in Bash. using
$ minify hello.js > hello.js
Bash will first execute the file redirect, prepare hello.js for writing by wiping it. Then it will execute the left hand side, allowing minify to read the now empty hello.jsShort of adding a flag called something like --overwrite-source that minifies, then writes the files back over themselves this project cannot support this.
@coderaiser What are your thoughts? would you be interested in a PR to that effect?
@code-forger yes, that’s amazing idea for a PR 😃.