|
2 | 2 | <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> |
3 | 3 | <channel> |
4 | 4 | <title>Guides on Elixirscript</title> |
5 | | - <link>https://elixirscript.github.io/guide/index.xml</link> |
| 5 | + <link>https://elixirscript.github.io/guide/</link> |
6 | 6 | <description>Recent content in Guides on Elixirscript</description> |
7 | 7 | <generator>Hugo -- gohugo.io</generator> |
8 | 8 | <language>en-us</language> |
9 | 9 | <lastBuildDate>Sun, 05 Mar 2017 14:27:53 -0600</lastBuildDate> |
10 | | - <atom:link href="https://elixirscript.github.io/guide/index.xml" rel="self" type="application/rss+xml" /> |
| 10 | + |
| 11 | + <atom:link href="https://elixirscript.github.io/guide/index.xml" rel="self" type="application/rss+xml" /> |
| 12 | + |
11 | 13 |
|
12 | 14 | <item> |
13 | 15 | <title>using with phoenix</title> |
14 | 16 | <link>https://elixirscript.github.io/guide/using-with-phoenix/</link> |
15 | 17 | <pubDate>Sun, 05 Mar 2017 14:27:53 -0600</pubDate> |
16 | 18 |
|
17 | 19 | <guid>https://elixirscript.github.io/guide/using-with-phoenix/</guid> |
18 | | - <description><p>This guide will walk through setting up a Phoenix project with Elixirscript. This guide assumes you have already created a Phoenix project</p> |
19 | | - |
20 | | -<p><strong>NOTE</strong>: This guide covers Phoenix 1.2. It will be updated when Phoenix 1.3 is released</p> |
21 | | - |
22 | | -<p>Update your mix.exs file to add the current version of elixirscript to your dependencies:</p> |
23 | | - |
24 | | -<pre><code class="language-elixir"> defp deps do |
25 | | - [ |
26 | | - #other deps |
27 | | - {:elixir_script, &quot;~&gt; x.x.x&quot;} |
28 | | - ] |
29 | | -</code></pre> |
30 | | - |
31 | | -<p>Run <code>mix deps.get</code>:</p> |
32 | | - |
33 | | -<pre><code class="language-bash">mix deps.get |
34 | | -</code></pre> |
35 | | - |
36 | | -<p>Next, Add the <code>elixir_script</code> compiler to your list of mix compilers. Also add in the <code>elixir_script</code> configuration:</p> |
37 | | - |
38 | | -<pre><code class="language-elixir">def project do |
39 | | - [app: :my_app, |
40 | | - version: &quot;0.0.1&quot;, |
41 | | - elixir: &quot;~&gt; 1.2&quot;, |
42 | | - elixirc_paths: elixirc_paths(Mix.env), |
43 | | - compilers: [:phoenix, :gettext, :elixir_script] ++ Mix.compilers, |
44 | | - build_embedded: Mix.env == :prod, |
45 | | - start_permanent: Mix.env == :prod, |
46 | | - deps: deps(), |
47 | | - elixir_script: [ |
48 | | - input: &quot;web/static/elixirscript&quot;, |
49 | | - output: &quot;web/static/js/build&quot; |
50 | | - ] |
51 | | - ] |
52 | | -end |
53 | | -</code></pre> |
54 | | - |
55 | | -<p>Elixirscript by default will looks for input in the <code>lib/elixirscript</code> directory. It will also by default output to <code>priv/elixirscript</code>. Update the input directory to <code>web/static/elixirscript</code>. Update the output directory to <code>web/static/js/build</code>. This lets it tie into Brunch&rsquo;s pipeline.</p> |
56 | | - |
57 | | -<p>Next, update the watcher configuration to use the Elixirscript watcher:</p> |
58 | | - |
59 | | -<pre><code class="language-elixir"> watchers: [node: [&quot;node_modules/brunch/bin/brunch&quot;, &quot;watch&quot;, &quot;--stdin&quot;, |
60 | | - cd: Path.expand(&quot;../&quot;, __DIR__)], mix: [&quot;elixirscript.watch&quot;]] |
61 | | -</code></pre> |
62 | | - |
63 | | -<p>Whenever your Elixirscript code changes, the elixirscript compiler will recompile it.</p> |
64 | | - |
65 | | -<p>Create <code>app.ex</code> in the <code>web/static/elixirscript</code> directory</p> |
66 | | - |
67 | | -<pre><code class="language-bash">touch web/static/elixirscript/app.ex |
68 | | -</code></pre> |
69 | | - |
70 | | -<p>For this example, write a simple module that will write <code>Hello, world</code> to the console on start:</p> |
71 | | - |
72 | | -<pre><code class="language-elixir">defmodule App do |
73 | | - |
74 | | - def start(_type, _args) do |
75 | | - :console.log(&quot;Hello, world&quot;) |
76 | | - end |
77 | | - |
78 | | -end |
79 | | -</code></pre> |
80 | | - |
81 | | -<p>Finally, update <code>web/static/js/app.js</code> to start your Elixirscript app:</p> |
82 | | - |
83 | | -<pre><code class="language-javascript">import Elixir from './build/Elixir.App'; |
84 | | -Elixir.start(Elixir.App, []) |
85 | | -</code></pre> |
86 | | - |
87 | | -<p>The empty array is list of initial arguments for your app.</p> |
88 | | - |
89 | | -<p>If you run <code>mix compile</code>, you should see a JavaScript file, <code>Elixir.App.js</code> in your <code>web/static/js/build</code> directory.</p> |
90 | | - |
91 | | -<p>If you run <code>mix phoenix.server</code>, open your browser, and then open your console, you should see <code>Hello, world</code>. Any changes should cause a reload</p> |
92 | | -</description> |
| 20 | + <description>This guide will walk through setting up a Phoenix project with Elixirscript. This guide assumes you have already created a Phoenix project |
| 21 | +NOTE: This guide covers Phoenix 1.2. It will be updated when Phoenix 1.3 is released |
| 22 | +Update your mix.exs file to add the current version of elixirscript to your dependencies: |
| 23 | +defp deps do [ #other deps {:elixir_script, &quot;~&gt; x.x.x&quot;} ] Run mix deps.get: |
| 24 | +mix deps.get Next, Add the elixir_script compiler to your list of mix compilers.</description> |
93 | 25 | </item> |
94 | 26 |
|
95 | 27 | </channel> |
|
0 commit comments