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: GettingStarted.md
+22-24Lines changed: 22 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,27 +29,24 @@ This is the help output of elixirscript
29
29
<input> path to elixir files or
30
30
the elixir code string if passed the -ex flag
31
31
options:
32
+
--js-module [<identifer>:<path>] A js module used in your code. ex: React:react
33
+
Multiple can be defined
32
34
-f --format [format] module format of output. options: es (default), common, umd
33
35
-o --output [path] places output at the given path
34
36
-ex --elixir read input as elixir code string
35
37
--full-build informs the compiler to do a full build instead of an incremental one
36
-
--core-path import path to the elixirscript standard lib
37
-
only used with the [output] option. When used, Elixir.js is not exported
38
38
-v --version the current version number
39
39
-h --help this message
40
40
41
41
the `<input>` is the elixir code string or file path you want to convert from elixir to javascript. Below is an example of using a code string and turning it into JavaScript
42
42
43
43
$ elixirscript ":atom" -ex
44
-
Symbol.for('atom')
45
-
46
-
It changed the elixir code, `:atom` into the JavaScript code `Symbol.for('atom')`. The `-ex` parameter lets the script know that the input is an Elixir code string instead of a file.
47
44
48
45
elixirscript also takes a path to your `.ex` files as well:
49
46
50
47
$ elixirscript "src" -o "dist"
51
48
52
-
If you look in the dist folder, you should see 2 folders. `app` contains your code and `elixir` contains the elixirscript standard library files.
49
+
If you look in the dist folder you'll see a file called `Elixir.App.js`
53
50
54
51
### Mix dependency
55
52
@@ -58,7 +55,7 @@ Adding Elixirscript to your mix project gives you the ability to add it to your
58
55
Add dependency to your deps in mix.exs:
59
56
60
57
```elixir
61
-
{:elixir_script, "~> 0.25"}
58
+
{:elixir_script, "~> 0.26"}
62
59
```
63
60
64
61
Elixirscript uses default input, 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.
@@ -69,7 +66,15 @@ Add dependency to your deps in mix.exs:
*`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.
97
+
91
98
### Macros
92
99
93
100
Elixirscript supports public macros. Private macros are currently unsupported.
@@ -117,27 +124,18 @@ You can call globally scoped modules you would an Elixir module
117
124
118
125
Only works if module begins with a captial letter
119
126
120
-
#### Importing Modules
121
-
122
-
To import modules, first you must `require` the `JS` module. Then import the module using `JS.import`
123
-
124
-
defmodule MyModule do
125
-
require JS
126
-
JS.import React, "react"
127
-
128
-
def func() do
129
-
React.render(my_component)
130
-
end
131
-
end
132
-
133
127
#### The JS module
134
128
135
129
The JS module has many other functions and macros. For more information, check out the docs.
136
130
137
131
#### Frontend Project Boilerplate
138
132
139
-
There is an [elixirscript frontend boilerplate project](https://github.com/bryanjos/elixirscript-project-boilerplate). This setup uses gulp and webpack to build and bundle assets.
133
+
There is an [elixirscript frontend boilerplate project](https://github.com/elixirscript/elixirscript-project-boilerplate). This setup uses gulp and webpack to build and bundle assets.
134
+
135
+
#### elixirscript-brunch
136
+
137
+
There is an Brunch plugin, [elixirscript-brunch](https://www.npmjs.com/package/elixirscript-brunch).
140
138
141
-
#### ElixirScript-Brunch
139
+
####
142
140
143
-
There is an Brunch plugin, [ElixirScript-Brunch](https://www.npmjs.com/package/elixirscript-brunch). There are instructions there on how to use it with Phoenix.
141
+
There is also a webpack loader, [elixirscript-loader](https://www.npmjs.com/package/elixirscript-loader).
Copy file name to clipboardExpand all lines: README.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
## ElixirScript [](http://hexdocs.pm/elixir_script/)[](https://travis-ci.org/elixirscript/elixirscript)[](https://beta.hexfaktor.org/github/bryanjos/elixirscript)[](https://gitter.im/elixirscript/elixirscript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
2
3
-
The goal is to convert a subset (or full set) of Elixir code to JavaScript, providing the ability to write JavaScript in Elixir. This is done by taking the Elixir AST and converting it into JavaScript AST and then to JavaScript code. This is done using the [Elixir-ESTree](https://github.com/bryanjos/elixir-estree) library.
3
+
The goal is to convert a subset (or full set) of Elixir code to JavaScript, providing the ability to write JavaScript in Elixir. This is done by taking the Elixir AST and converting it into JavaScript AST and then to JavaScript code. This is done using the [Elixir-ESTree](https://github.com/elixirscript/elixir-estree) library.
4
4
5
5
Requirements
6
6
===========
@@ -65,13 +65,17 @@ Please check the [CONTRIBUTING.md](CONTRIBUTING.md)
65
65
66
66
### Example projects
67
67
*[hello](https://github.com/bryanjos/hello) Shows using Phoenix + Elixirscript with file watching
68
-
*[Elixirscript frontend boilerplate](https://github.com/bryanjos/elixirscript-project-boilerplate) A boilerplate project for elixirscript frontends
68
+
*[Elixirscript frontend boilerplate](https://github.com/elixirscript/elixirscript-project-boilerplate) A boilerplate project for elixirscript frontends
69
69
*[Elixirscript React example](https://github.com/bryanjos/elixirscript_react) An example of using with React
There is a [1.0.0 Milestone](https://github.com/bryanjos/elixirscript/milestones/1.0.0) defined which includes issues that are needed to be cleared before 1.0 can be reached.
0 commit comments