Convert JavaScript files to bookmarklets
Download it to /usr/local/bin
via cURL:
$ curl https://raw.githubusercontent.com/rafaelrinaldi/bookmarkletify/master/bookmarkletify > /usr/local/bin/bookmarkletify
Compile the binary:
$ chmod +x /usr/local/bin/bookmarkletify
Node.js (>=8
)
Usage: bookmarkletify <FILE>
Convert JavaScript files to bookmarklets
Example:
$ bookmarkletify script.js
Via stdin:
$ cat script.js | bookmarkletify
Options:
-h --help Display software usage
To generate a simple bookmarklet for Google Chrome that displays 42
on screen:
$ # Generate the output and pipe it the system clipboard
$ echo "alert(42);" | bookmarkletify | pbcopy
Cmd Shift b to show the bookmarks bar, then right click on it and select "Add Page":
Give your bookmarklet a name and, on the URL field, paste the code we previously generated from the command line:
Now if you click on the bookmarklet you should see the expected result:
MIT © Rafael Rinaldi