File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 19
19
``` elixir
20
20
config :phoenix , :template_engines ,
21
21
slim: PhoenixSlime .Engine ,
22
- slime: PhoenixSlime .Engine
22
+ slime: PhoenixSlime .Engine ,
23
+ slimleex: PhoenixSlime .LiveViewEngine # If you want to use LiveView
23
24
```
24
25
25
26
An example project can be found at [ slime-lang/phoenix_slime_example] [ phoenix_slime_example ] .
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ defmodule PhoenixSlime.Engine do
6
6
"""
7
7
def compile ( path , _name ) do
8
8
path
9
- |> read!
9
+ |> read! ( )
10
10
|> EEx . compile_string ( engine: Phoenix.HTML.Engine , file: path , line: 1 )
11
11
end
12
12
Original file line number Diff line number Diff line change
1
+ defmodule PhoenixSlime.LiveViewEngine do
2
+ @ behaviour Phoenix.Template.Engine
3
+
4
+ @ doc """
5
+ Precompiles the String file_path into a function definition
6
+ """
7
+ def compile ( path , _name ) do
8
+ path
9
+ |> read! ( )
10
+ |> EEx . compile_string ( engine: Phoenix.LiveView.Engine , file: path , line: 1 )
11
+ end
12
+
13
+ defp read! ( file_path ) do
14
+ file_path
15
+ |> File . read! ( )
16
+ |> Slime.Renderer . precompile ( )
17
+ end
18
+ end
You can’t perform that action at this time.
0 commit comments