Update unknown profile error, closes #23
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/lib/dart_sass.ex b/lib/dart_sass.ex
index 186bcaa..848a8f5 100644
--- a/lib/dart_sass.ex
+++ b/lib/dart_sass.ex
@@ -103,11 +103,11 @@ defmodule DartSass do
def config_for!(profile) when is_atom(profile) do
Application.get_env(:dart_sass, profile) ||
raise ArgumentError, """
- unknown dart_sass profile. Make sure the profile is defined in your config files, such as:
+ unknown dart_sass profile. Make sure the profile named #{inspect(profile)} is defined in your config files, such as:
config :dart_sass,
#{profile}: [
- args: ~w(css/app.scss ../priv/static/assets/app.css),
+ args: ~w(css/app.scss:../priv/static/assets/app.css),
cd: Path.expand("../assets", __DIR__)
]
"""
diff --git a/test/dart_sass_test.exs b/test/dart_sass_test.exs
index 7b6b4d2..09f392b 100644
--- a/test/dart_sass_test.exs
+++ b/test/dart_sass_test.exs
@@ -33,6 +33,14 @@ defmodule DartSassTest do
end) =~ @version
end
+ test "errors on invalid profile" do
+ assert_raise ArgumentError,
+ ~r<unknown dart_sass profile. Make sure the profile named :"assets/css/app.scss" is defined>,
+ fn ->
+ assert DartSass.run(:"assets/css/app.scss", ["../priv/static/assets/app.css"])
+ end
+ end
+
@tag :tmp_dir
test "compiles", %{tmp_dir: dir} do
dest = Path.join(dir, "app.css")