This shard is a Crystal bridge to the official CoffeeScript compiler.
require "coffee-script"
CoffeeScript.compile(File.read("script.coffee")) # => compiled codeThe code in this library is a direct port of Ruby's coffee-script gem.
Add this to your project's shard.yml:
dependencies:
coffee-script:
github: jessedoyle/coffee-script
version: ~> 1.0then execute shards install.
You can use an alternate CoffeeScript compiler version by setting the COFFEESCRIPT_SOURCE_PATH environment variable:
export COFFEESCRIPT_SOURCE_PATH=/my/custom/path/coffee-script.jsThe compile method also accepts additional arguments that may be passed to the runtime:
src = File.read("script.coffee")
CoffeeScript.compile(src, { bare: true }) # => compiled codeThis library depends on the coffee-script-source shard, please see the releases page for compiler versions.
This library uses duktape.cr as the javascript runtime.
Distributed under the MIT License. See LICENSE for details.