Skip to content

Commit d20c27e

Browse files
author
Étienne Lévesque
committed
feat: Add config option to pick json library
1 parent 4afd6dd commit d20c27e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/ex_css_modules/ex_css_modules.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ defmodule ExCSSModules do
4040
true ->
4141
(filename <> ".json")
4242
|> File.read!()
43-
|> Poison.decode!()
43+
|> json_library().decode!()
4444

4545
false ->
4646
%{}
@@ -209,4 +209,6 @@ defmodule ExCSSModules do
209209

210210
defp join_class_name([_ | _] = list), do: Enum.join(list, " ")
211211
defp join_class_name([]), do: nil
212+
213+
defp json_library, do: Application.get_env(:ex_css_modules, :json_library, Poison)
212214
end

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ defmodule ExCSSModules.Mixfile do
5050
{:excoveralls, "~> 0.14.4", only: :test},
5151
{:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false},
5252
{:phoenix_html, "~> 1.0 or ~> 2.0 or ~> 3.0"},
53-
{:poison, "~> 4.0 or ~> 5.0"},
53+
{:poison, "~> 4.0 or ~> 5.0", optional: true},
5454
{:mix_test_watch, "~> 1.1", only: :dev, runtime: false},
5555
{:credo, "~> 1.6", only: [:dev, :test], runtime: false}
5656
]

0 commit comments

Comments
 (0)