Skip to content

Conversation

@jessedijkstra
Copy link
Contributor

The embed option works fine if you use true or false as values as they are values by definition, if you however use something like Mix.env == :prod the code is treated as a quoted value which is always truthy resulting in an AST tree:

{:{}, [],
 [:==, [context: DetroitWeb, import: Kernel, line: 6],
  [{:{}, [],
    [{:{}, [],
      [:., [line: 6],
       [{:{}, [],
         [:__aliases__, [alias: false, counter: -576460752303420796, line: 6],
          [:Mix]]}, :env]]}, [line: 6], []]}, :prod]]}

By evaluating the condition things like Mix.env can be used to set the value.

@codecov-io
Copy link

Codecov Report

Merging #7 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master     #7   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           2      2           
  Lines          24     25    +1     
=====================================
+ Hits           24     25    +1
Impacted Files Coverage Δ
lib/ex_css_modules/view.ex 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c323769...ac8d92d. Read the comment docs.

@jessedijkstra jessedijkstra merged commit 45995b3 into master Oct 20, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants