CoffeeScript compiler for elixir
API documentation is available at https://hexdocs.pm/coffee_compiler/Coffee.html
Add coffee_compiler
to your list of dependencies in mix.exs
:
def deps do
[
{:coffee_compiler, "~> 0.1"}
]
end
coffee = "/path/to/file.coffee"
Coffee.compile(coffee)
{:ok, "console.log(\"Application\")"}
Coffee.compile(coffee, [root_path: "/absolute/path/to/import/file"})
{:ok, "var o;o=function(o){return`this is Foo file: ${o}`};console.log(o)"}
You should pass an root_path
parameter if you use @import
derective to include some code
Use relavtive paths @import ./relative/path/to/file
in .coffee files
CoffeeCompiler is released under the MIT License