Open sdht0 opened 1 year ago
I should perhaps mention I use chromium using --browser-executable-path $(which chromium)
.
Okay it seems to be due to the type of browser-script
being array
in args.js
. Changing it to string makes it work for me! Not sure how to correctly pass the arguments for array
type. Using --
as per yargs
doc does not seem to work.
I agree that the help is not very clear about this. Actually, you can pass --browser-script
multiple times, that's why it appears as an array.
So are you able to use the cli with only one argument to --browser-script
. What I show in my first post is that the command does nothing when I only have one script.
Sorry for the misunderstanding, I guess I was tired when I replied.
I confirm that running single-file --browser-script test.js https://www.example.com
works for me. The test.js
file contains onload = () => document.body.innerHTML += "Hello world!";
and the saved page contains "Hello world!" as expected.
single-file --browser-script test.js --browser-executable-path $(which chromium) https://www.example.com
works
single-file --browser-executable-path $(which chromium) --browser-script test.js https://www.example.com
does not
So --browser-script
cannot be the last argument if there are multiple arguments being passed. Seems like a yargs
bug.
Hi,
Running
single-file --browser-script "./script.js" "<url>"
simply exits seemingly without any output or error but removing the--browser-script
argument makes it work as expected.script.js
contains the second script fromhttps://github.com/gildas-lormeau/SingleFile/wiki/How-to-execute-a-user-script-before-a-page-is-saved
.How do I get it to work?
Thanks.