A simple tool to compile Ruby code to JavaScript using Opal
npm install bestikk-opal-compilerifdef::env-github[]
image:http://img.shields.io/travis/bestikk/bestikk-opal-compiler.svg[Travis build status, link=https://travis-ci.org/bestikk/bestikk-opal-compiler]
image:http://img.shields.io/npm/v/bestikk-opal-compiler.svg[npm version, link=https://www.npmjs.org/package/bestikk-opal-compiler]
endif::[]
A simple tool to compile Ruby code to JavaScript using Opal.
$ npm i --save-dev bestikk-opal-compiler
``javascript
var opalCompiler = require('bestikk-opal-compiler');
var compiler = opalCompiler({
dynamicRequireLevel: 'ignore',
defaultPaths: ['special/directory']
});
compiler.compile('hello.rb', 'hello.js'); // <1>
compiler.compile('module/hello', 'module.js', ['extra/directory']); // <2>
`hello.rb
<1> Compile Ruby script to hello.jsmodule/hello
<2> Compile Ruby module to module.js` using an extra directory