@@ -295,13 +295,37 @@ defmodule Scenic.Assets.Static do
295
295
# ===========================================================================
296
296
297
297
# --------------------------------------------------------
298
- # internal config sugar
299
- defp config ( ) , do: Application . get_env ( :scenic , :assets )
300
-
301
298
@ doc """
302
299
Return the configured asset library module.
303
300
"""
304
- def module ( ) , do: config ( ) [ :module ]
301
+ def module ( ) do
302
+ with { :ok , config } <- Application . fetch_env ( :scenic , :assets ) ,
303
+ { :ok , module } <- Keyword . fetch ( config , :module ) do
304
+ module
305
+ else
306
+ _ ->
307
+ raise """
308
+ No assets module is configured.
309
+ You need to create an assets modulein your application.
310
+ Then connect it to Scenic with some config.
311
+
312
+ Example assets module that includes an optional alias:
313
+
314
+ defmodule MyApplication.Assets do
315
+ use Scenic.Assets.Static,
316
+ otp_app: :my_application,
317
+ alias: [
318
+ my_parrot: "images/my_parrot.jpg"
319
+ ]
320
+ end
321
+
322
+ Example configuration script (this goes in your config.exs file):
323
+
324
+ config :scenic, :assets,
325
+ module: MyApplication.Assets
326
+ """
327
+ end
328
+ end
305
329
306
330
@ doc "Return the compiled asset library."
307
331
def library ( ) , do: module ( ) . library ( )
0 commit comments