0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Provides dart2js compiling for compatibility.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Dart2Js ruby-dart2js API Documentation Gem Version

Idea

Provide automated transcoding from Dart to Javascript.

Setup

Add gem

Gemfile

gem 'ruby-dart2js'
Find SDK

DartJs will look for the dart2js binary in the following order:

  1. DART2JS_SOURCE_PATH direct path to binary env DARTJS_SOURCE_PATH=/opt/dart-sdk/bin/dart2js
  2. DART_SDK_HOME path to sdk env DART_SDK_HOME=/opt/dart-sdk
  3. PATH looks for dart2js in your PATH-variable

Usage

dart_compiler = Dart2Js.new(file, options)
dart_compiler.compile
dart_compiler.get_js_content
dart_compiler.out_file

Initialization takes either dart-sourcecode directly or an instance of File as first argument and an options-hash as second argument. :dart2js_binary and :out_file may be provided with the options-hash.

dart_compiler.compile actually runs the dart2js command, the output of the run will be saved in @result and the final js stays in @out_file and may be read with dart_compiler.get_js_content.

With version 0.2.0 Dart2Js::compile now accepts a boolean argument for minifying, it's optional and true by default.