0

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 ?

1
  • 1
    Actually Opan compile Ruby to JS, did you mean JS to Ruby? Commented Jan 29, 2015 at 8:22

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.