This is a Ruby wrapper around the Sweet.js macro processor.
Go to sweetjs.org for more information.
gem install sweetjs
Ensure that your environment has a JavaScript interpreter supported by ExecJS. Using the therubyracer gem is a good option.
In your Gemfile
:
gem "sweetjs"
gem "therubyracer"
require 'sweetjs'
SweetJS.new.compile(File.read("source.sjs"))
# => processed JavaScript source
# Or alternatively:
SweetJS.compile(File.read("source.sjs"))
Thanks to Ville Lautanala who unwittingly wrote most of the code and the README.
© Garry Hill, Magnetised Ltd. Released under MIT license, see LICENSE.txt for more details.