Last active
December 14, 2015 02:59
-
-
Save plapier/5018143 to your computer and use it in GitHub Desktop.
Convert Javascript to CoffeeScript (vice versa) directly from vim.
Uses js2coffee library.
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 ruby | |
require 'tempfile' | |
file = Tempfile.new(['js2coffee', '.js']) | |
file.write ARGF.read # write vim selection to tmp file | |
file.rewind | |
file.close | |
puts `js2coffee #{file.path}` # requires js2coffee | |
file.unlink # deletes the temp file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@gabebw I tried your solution but still got Invalid Token due to the BOM header.
So I modified your solution a bit