elixir_script v0.32.1 ElixirScript View Source
ElixirScript acts as a mix compiler. This means that when you execute
ElixirScript’s compiler will run as well. Make sure to add ElixirScript to your
list of compilers in mix.exs.
ElixirScript must be told which modules to use as the entry to your ElixirScript application.
This is done by adding an
elixir_script key to your project configuration whose value is a keyword list of options.
input key and make the value either the name of a module or a list of modules
ElixirScript by default places output in
priv/elixir_script/build. If you wish to change this,
output key to your ElixirScript configuration.
An example configuration for a project is shown below
def project do [ app: :my_app, version: "0.1.0", elixir: "~> 1.0", deps: deps, # Add elixir_script as a compilter compilers: Mix.compilers ++ [:elixir_script], # Our elixir_script configuration elixir_script: [ # Entry module. Can also be a list of modules input: MyEntryModule, # Output path. Either a path to a js file or a directory output: "priv/elixir_script/build" ] ] end
Available options are:
input(required): The entry module(s) for your application or library
.. If using output directly in a browser, you may want to make it something like
/jsor some uri.
elixirscript.build.js in the
<script type="module"> import MyEntryModule from '/js/Elixir.MyEntryModule.js' const myInitialArgs =  MyEntryModule.start(Symbol.for('normal'), myInitialArgs) </script>
ElixirScript can use many of the same Hex packages and dependencies that currently exist.
It is also possible to make packages that are specific to ElixirScript. If you decide to
make such a package, please prepend
elixir_script to the app name. For instance is making
a package for ElixirScript with FFI modules for interacting with React, the name would be
elixir_script_react. This is to make sure that other developers know that a package in Hex
is specifically for use with ElixirScript.
ElixirScript does not support
receive or any of OTP at this time.