https://github.com/rafaelrinaldi/bookmarkletify
:bookmark: Convert JavaScript files to bookmarklets
https://github.com/rafaelrinaldi/bookmarkletify
bookmarklet cli
Last synced: over 1 year ago
JSON representation
:bookmark: Convert JavaScript files to bookmarklets
- Host: GitHub
- URL: https://github.com/rafaelrinaldi/bookmarkletify
- Owner: rafaelrinaldi
- License: mit
- Created: 2016-02-13T04:20:26.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-05-09T00:47:33.000Z (about 6 years ago)
- Last Synced: 2025-03-20T12:54:38.980Z (over 1 year ago)
- Topics: bookmarklet, cli
- Language: Shell
- Homepage:
- Size: 85.9 KB
- Stars: 18
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bookmarkletify [](https://semaphoreci.com/rafaelrinaldi/bookmarkletify)
> Convert JavaScript files to bookmarklets
## Install
Download it to `/usr/local/bin` via [cURL](https://curl.haxx.se):
```sh
$ curl https://raw.githubusercontent.com/rafaelrinaldi/bookmarkletify/master/bookmarkletify > /usr/local/bin/bookmarkletify
```
Compile the binary:
```sh
$ chmod +x /usr/local/bin/bookmarkletify
```
## Requirements
[Node.js](https://nodejs.org) (`>=8`)
## Usage
```
Usage: bookmarkletify
Convert JavaScript files to bookmarklets
Example:
$ bookmarkletify script.js
Via stdin:
$ cat script.js | bookmarkletify
Options:
-h --help Display software usage
```
### Creating a bookmarklet
To generate a simple bookmarklet for Google Chrome that displays `42` on screen:
```sh
$ # 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:

## License
MIT © [Rafael Rinaldi](http://rinaldi.io)
---