Skip to content

Commit 1f01df2

Browse files
committed
draft of next elixirscript release post
1 parent c8fded9 commit 1f01df2

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
+++
2+
date = "2017-02-25T16:46:24-06:00"
3+
title = "elixirscript 0.26.0 released"
4+
draft = true
5+
+++
6+
7+
For a full list of changes, check out out the [changelog](https://github.com/elixirscript/elixirscript/blob/master/CHANGELOG.md).
8+
9+
This version of Elixirscript has a lot of major changes. Here are some of the changes in the new release:
10+
11+
## Bundled output
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
18+
19+
## Removed `@on_js_load`
20+
21+
`@on_js_load` is no more. In order to start you application, you would do the following:
22+
23+
```js
24+
//Note: An ES module example. Update for your module output of choice
25+
import Elixir from "./Elixir.App";
26+
27+
const my_inital_args = [];
28+
Elixir.start(Elixir.MyApp, my_inital_args);
29+
```
30+
31+
This looks for a `start/2` function in the `MyApp` module. It tries to mimick the API of a normal
32+
Elixir Application.
33+
34+
```elixir
35+
def start(type, args) do
36+
end
37+
```
38+
39+
## Removed `JS.import`
40+
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.
43+
44+
```elixir
45+
js_modules: [
46+
{React, "react"},
47+
{ReactDOM, "react-dom"}
48+
]
49+
```
50+
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+
```
76+
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
79+

0 commit comments

Comments
 (0)