You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
## [Unreleased]
8
8
9
9
### Added
10
-
- ElixirScript now has an FFI layer for interoperability with JavaScript. For more details, see documentation at `ElixirScript.FFI`
10
+
- ElixirScript now has a Foreign Function Interface (FFI) for interoperability with JavaScript. For more details, see documentation at `ElixirScript.FFI`
11
11
-`ElixirScript.JS.mutate/3`
12
12
-`ElixirScript.JS.map_to_object/1`
13
13
14
14
### Changed
15
15
- Compiler has been completely rewritten. ElixirScript now requires Erlang 20+ and Elixir 1.5+
16
16
-`JS` module renamed to `ElixirScript.JS`
17
+
- Default output path is now `priv/elixir_script/build`
18
+
19
+
### Removed
20
+
- Support for CommonJS and UMD output formats has been removed. Output will be in ES module format
21
+
- The `js_modules` option has been removed in favor of the new FFI
Copy file name to clipboardExpand all lines: GettingStarted.md
+13-17Lines changed: 13 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,11 @@ Adding Elixirscript to your mix project gives you the ability to add it to your
7
7
Add dependency to your deps in mix.exs:
8
8
9
9
```elixir
10
-
{:elixir_script, "~> 0.29"}
10
+
{:elixir_script, "~> 0.30"}
11
11
```
12
12
13
13
Elixirscript uses default output and module formats if options are not given. If you wish to change any or all options, add an `elixir_script` key to your project configuration.
14
-
14
+
15
15
```elixir
16
16
defprojectdo
17
17
[
@@ -21,13 +21,7 @@ Elixirscript uses default output and module formats if options are not given. If
21
21
deps: deps,
22
22
elixir_script: [
23
23
input:MyEntryModule,
24
-
output:"priv/elixirscript/Elixir.App.js",
25
-
format::es,
26
-
js_modules: [
27
-
{React, "react"},
28
-
{ReactDOM, "react-dom"},
29
-
{Phoenix, "phoenix", default:false}
30
-
]
24
+
output:"priv/elixir_script/build/Elixir.App.js"
31
25
],
32
26
compilers:Mix.compilers++ [:elixir_script]
33
27
]
@@ -38,22 +32,24 @@ Available options are:
38
32
39
33
*`input`: The entry module(s) for your application or library
40
34
41
-
*`output`: The path of the generated JavaScript file. (defaults to `priv/elixirscript`)
35
+
*`output`: The path of the generated JavaScript file. (defaults to `priv/elixir_script/build`)
42
36
43
37
If path ends in `.js` then that will be the name of the file. If a directory is given,
44
38
file will be named `Elixir.App.js`
45
39
46
-
*`format`: The module format of generated JavaScript code. (defaults to `:es`). Choices are:
47
-
48
-
*`:es` - ES Modules
49
40
50
-
*`:common` - CommonJS
41
+
Now run `mix compile` and you should see a JavaScript file named `Elixir.App.js` in the `priv/elixir_script/build/` directory. ElixirScript outputs JavaScript in the ES Module format. If your browser supports it, you can include the output in a script tag with the type "module"
51
42
52
-
*`:umd` - UMD
43
+
```html
44
+
<scripttype="module">
45
+
importElixirfrom'./Elixir.App.js'
46
+
constmyInitialArgs= []
53
47
54
-
*`js_modules`: A list of JavaScript imports to add. Each item must be 2-tuple or a 3-tuple. The third element is an optional keyword list of options:
48
+
Elixir.start(Elixir.MyEntryModule, myInitialArgs)
49
+
</script>
50
+
```
55
51
56
-
*`default` - Defaults to true. Set to false if the imported module has no default export.
52
+
If your browser does not yet support ES modules directly, use a tool such as [webpack](https://webpack.js.org/) or [brunch](http://brunch.io/)to convert it into something that can be used in the browser
0 commit comments