Created
February 17, 2012 23:11
-
-
Save chrismytton/1856012 to your computer and use it in GitHub Desktop.
bookmarklet creater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs = require 'fs' | |
coffee = require 'coffee-script' | |
uglify = require 'uglify-js' | |
file = process.argv[2] | |
unless file? | |
console.warn "Usage: bookmarklet <script.{js,coffee}>" | |
process.exit 1 | |
fs.readFile file, 'utf8', (err, data) -> | |
throw err if err | |
if file.match /\.coffee$/ | |
console.log "javascript:#{encodeURI uglify coffee.compile data}" | |
else | |
console.log "javascript:#{encodeURI uglify data}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
require('coffee-script'); | |
require('./bookmarklet'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"author": "", | |
"name": "bookmarklet", | |
"description": "Easily create bookmarklets", | |
"version": "0.0.0", | |
"bin": "./cli.js", | |
"repository": { | |
"type": "git", | |
"url": "git://gist.github.com/1856012.git" | |
}, | |
"engines": { | |
"node": ">= 0.4.0" | |
}, | |
"dependencies": { | |
"coffee-script": "1.2.0", | |
"uglify-js": "1.2.5" | |
}, | |
"devDependencies": {}, | |
"optionalDependencies": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To install this with
npm(1)
run the following:Then you can use the
bookmarklet
script: