Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/ex_css_modules/view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@ defmodule ExCSSModules.View do
"""

defmacro __using__(opts \\ []) do
{file, [file: relative_to]} =
{filename, [file: relative_to]} =
Code.eval_quoted(opts[:stylesheet], file: __CALLER__.file)

file = Path.expand(file, Path.dirname(relative_to))
{embed, _} =
Code.eval_quoted(opts[:embed_stylesheet])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why break this into two lines?


filename = Path.expand(filename, Path.dirname(relative_to))

quote do
@stylesheet unquote(
if opts[:embed_stylesheet] do
Macro.escape(ExCSSModules.read_stylesheet(file))
if embed do
Macro.escape(ExCSSModules.read_stylesheet(filename))
else
Macro.escape(file)
Macro.escape(filename)
end
)

Expand Down