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: content/post/elixirscript-0.26.0-released.md
+7-37Lines changed: 7 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,11 @@ This version of Elixirscript has a lot of major changes. Here are some of the ch
10
10
11
11
## Bundled output
12
12
13
-
This release is the first release to bundle all modules into one JavaScript file.
14
-
The output will now include only the following:
15
-
16
-
*`Elixir.Bootstrap.js` - The Elixirscript bootstrapping JavaScript
17
-
*`Elixir.App.js`. - The bundled modules
13
+
This release is the bundle all output into a single file. Now the only file output will be `Elixir.App.js.`
18
14
19
15
## Removed `@on_js_load`
20
16
21
-
`@on_js_load` is no more. In order to start you application, you would do the following:
17
+
`@on_js_load` is no more. To start an application, do the following:
22
18
23
19
```js
24
20
//Note: An ES module example. Update for your module output of choice
@@ -28,8 +24,7 @@ const my_inital_args = [];
28
24
Elixir.start(Elixir.MyApp, my_inital_args);
29
25
```
30
26
31
-
This looks for a `start/2` function in the `MyApp` module. It tries to mimick the API of a normal
32
-
Elixir Application.
27
+
This looks for a `start/2` function in the `MyApp` module. It tries to mimick the API of a normal Elixir Application.
33
28
34
29
```elixir
35
30
defstart(type, args) do
@@ -38,8 +33,7 @@ Elixir Application.
38
33
39
34
## Removed `JS.import`
40
35
41
-
`JS.import` is also no more. External JavaScript modules now must be defined in configuration.
42
-
A new configuration, `js_modules` is where they go.
36
+
`JS.import` is also no more. External JavaScript modules are now defined in configuration. A new configuration, `js_modules` is where they go.
43
37
44
38
```elixir
45
39
js_modules: [
@@ -48,32 +42,8 @@ js_modules: [
48
42
]
49
43
```
50
44
51
-
In the example above, both `React` and `ReactDOM` will be imported at the top of the bundled output.
52
-
Each item can be a 2-tuple or a 3-tuple with the third element being a keyword list of options for the
53
-
defined module output format.
54
-
55
-
56
-
## elixirscript.exs config file
57
-
58
-
If you are using Elixirscript outside of a mix project,
59
-
you can still give it configuration using an `elixirscript.exs` file. The contents must be a keyword list
60
-
with the exact same options are the elixir_script config defined in mix projects.
61
-
62
-
```elixir
63
-
#example elixirscript.exs file
64
-
65
-
[
66
-
input: ["app/elixirscript"],
67
-
output:"dist",
68
-
format::common,
69
-
js_modules: [
70
-
{React, "react"},
71
-
{ReactDOM, "react-dom"}
72
-
]
73
-
]
74
-
75
-
```
45
+
Elixirscript adds both `React` and `ReactDOM` imports to the top of the bundled output. Each item must be 2-tuple or a 3-tuple. The third element is an optional keyword list of options.
76
46
77
-
The `elixirscript` CLI will look for an `elixirscript.exs` file in the current directory,
78
-
or you can specify one with the `-c` flag
47
+
The CLI now has a `js-module` to support the above.
0 commit comments