ucbi / uniform

Write less boilerplate and reuse more code in your portfolio of Elixir apps
https://hex.pm/packages/uniform
Apache License 2.0
33 stars 1 forks source link

Remove warning and match dotfiles in compiled templates #40

Closed paulstatezny closed 2 years ago

paulstatezny commented 2 years ago

I should have tested v0.5.0 against our codebase more thoroughly before publishing. There were 2 issues:

  1. Templates starting with . could no longer be used
  2. During mix uniform.eject, you'd receive a warning for any template that didn't use app:
warning: variable "app" is unused (if the variable is not meant to be used, prefix it with an underscore)
  lib/my_base_app/uniform/templates/path/to/template.eex:1: MyBaseApp.Uniform.Blueprint."path/to/template.eex"/1

To fix (1), we now pass match_dot: true to Path.wildcard when searching for templates to compile.

To fix (2), we mimic Phoenix.View by manually creating the function and doing _ = var!(app) to remove the warning, instead of using EEx.function_from_file.