I learned about Opal for Ruby recently and would like to convert a Ruby file to Javascript. I've used Coffeescript before, and I can compile a Coffeescript file to Javascript with a certain command on Node.js. How do I do the same with Ruby and Opal to Javascript ?
-
1Actually Opan compile Ruby to JS, did you mean JS to Ruby?Ethaan– Ethaan2015年01月29日 08:22:56 +00:00Commented Jan 29, 2015 at 8:22
1 Answer 1
To compile your Ruby to JavaScript:
opal -c program.rb > program.js
-c means "compile to JavaScript" (as opposed to "execute now"); the JavaScript is written to the standard output, so you can use redirection to capture it to a file.
answered Jan 29, 2015 at 8:56
Amadan
200k23 gold badges254 silver badges321 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default