Skip to content

Commit

Permalink
Merge pull request #1 from doomspork/wire-up-slim-fast
Browse files Browse the repository at this point in the history
Support slim templates
  • Loading branch information
doomspork committed Aug 4, 2015
2 parents 4e6a39e + 21a3cd7 commit b33643b
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 39 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Phoenix Template Engine for Haml

> Powered by [Calliope](https://github.com/nurugger07/calliope)
> Powered by [SlimFast](https://github.com/doomspork/slim_fast)
## Usage

1. Add `{:phoenix_haml, "~> 0.1.1"}` to your deps in `mix.exs`.
If you generated your app from the Phoenix master branch,
add phoenix_haml's master branch to your deps instead.
`{:phoenix_haml, github: "chrismccord/phoenix_haml"}`
2. Add the following your Phoenix `config/config.exs`
1. Add `{:phoenix_slim, "~> 0.1.0"}` to your deps in `mix.exs`.
2. Add the following your Phoenix `config/config.exs`:

```elixir
config :phoenix, :template_engines,
haml: PhoenixHaml.Engine
slim: PhoenixSlim.Engine
```

## License

Please see [LICENSE](https://github.com/doomspork/slim_fast/blob/master/LICENSE) for licensing details.
3 changes: 1 addition & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use Mix.Config

config :phoenix, :template_engines,
haml: PhoenixHaml.Engine

slim: PhoenixSlim.Engine
2 changes: 0 additions & 2 deletions lib/phoenix_haml.ex

This file was deleted.

2 changes: 2 additions & 0 deletions lib/phoenix_slim.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
defmodule PhoenixSlim do
end
8 changes: 5 additions & 3 deletions lib/phoenix_haml/engine.ex → lib/phoenix_slim/engine.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule PhoenixHaml.Engine do
defmodule PhoenixSlim.Engine do
@behaviour Phoenix.Template.Engine

@doc """
Precompiles the String file_path into a function defintion, using Calliope engine
Precompiles the String file_path into a function defintion, using SlimFast
"""
def compile(path, _name) do
path
Expand All @@ -11,6 +11,8 @@ defmodule PhoenixHaml.Engine do
end

defp read!(file_path) do
file_path |> File.read! |> Calliope.Render.precompile
file_path
|> File.read!
|> SlimFast.Renderer.precompile
end
end
24 changes: 12 additions & 12 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
defmodule PhoenixHaml.Mixfile do
defmodule PhoenixSlim.Mixfile do
use Mix.Project

def project do
[
app: :phoenix_haml,
version: "0.1.2",
elixir: "~> 1.0.1 or ~> 1.1",
app: :phoenix_slim,
version: "0.1.0",
elixir: "~> 1.0",
deps: deps,
package: [
contributors: ["Chris McCord"],
contributors: ["Sean Callan"],
licenses: ["MIT"],
links: %{github: "https://github.com/chrismccord/phoenix_haml"}
links: %{github: "https://github.com/doomspork/phoenix_slim"}
],
description: """
Phoenix Template Engine for Haml
Phoenix Template Engine for Slim
"""
]
end

def application do
[applications: [:phoenix, :calliope]]
[applications: [:phoenix, :slim_fast]]
end

defp deps do
[
{:phoenix, "~> 0.13"},
{:phoenix_html, "~> 1.1"},
{:cowboy, "~> 1.0.0", only: [:dev, :test]},
{:calliope, "~> 0.3.0"}
{:phoenix, "~> 0.15.0"},
{:phoenix_html, "~> 2.0"},
{:cowboy, "~> 1.0", only: [:dev, :test]},
{:slim_fast, "~> 0.2.0"}
]
end
end
12 changes: 6 additions & 6 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
%{"calliope": {:hex, :calliope, "0.3.0"},
"cowboy": {:hex, :cowboy, "1.0.0"},
%{"cowboy": {:hex, :cowboy, "1.0.2"},
"cowlib": {:hex, :cowlib, "1.0.1"},
"phoenix": {:hex, :phoenix, "0.13.1"},
"phoenix_html": {:hex, :phoenix_html, "1.2.1"},
"plug": {:hex, :plug, "0.13.0"},
"phoenix": {:hex, :phoenix, "0.15.0"},
"phoenix_html": {:hex, :phoenix_html, "2.0.1"},
"plug": {:hex, :plug, "0.14.0"},
"poison": {:hex, :poison, "1.4.0"},
"ranch": {:hex, :ranch, "1.0.0"}}
"ranch": {:hex, :ranch, "1.1.0"},
"slim_fast": {:hex, :slim_fast, "0.2.0"}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%html
%body
html
body
= @inner

2 changes: 0 additions & 2 deletions test/fixtures/templates/my_app/page/new.html.haml

This file was deleted.

1 change: 1 addition & 0 deletions test/fixtures/templates/my_app/page/new.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h2 New Template
4 changes: 2 additions & 2 deletions test/phoenix_haml_test.exs → test/phoenix_slim_test.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule PhoenixHamlTest do
defmodule PhoenixSlimTest do
use ExUnit.Case
alias Phoenix.View

Expand All @@ -8,7 +8,7 @@ defmodule PhoenixHamlTest do
use Phoenix.HTML
end

test "render a haml template with layout" do
test "render a slim template with layout" do
html = View.render(MyApp.PageView, "new.html",
message: "hi",
layout: {MyApp.PageView, "application.html"}
Expand Down

0 comments on commit b33643b

Please sign in to comment.