Last active
December 11, 2016 17:51
-
-
Save khusnetdinov/0e2eada270fee80640be8cf32a50ba37 to your computer and use it in GitHub Desktop.
Phoenix embed templates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Embed all defined templates | |
root = Path.expand("../templates", __DIR__) | |
for {format, source, _} <- @new ++ @ecto ++ @brunch ++ @html ++ @static ++ @bare do | |
unless format == :keep do | |
@external_resource Path.join(root, source) | |
def render(unquote(source)), do: unquote(File.read!(Path.join(root, source))) | |
end | |
end | |
# Embed missing files from Phoenix static. | |
embed_text :phoenix_js, from_file: Path.expand("../../priv/static/phoenix.js", __DIR__) | |
embed_text :phoenix_png, from_file: Path.expand("../../priv/static/phoenix.png", __DIR__) | |
embed_text :phoenix_favicon, from_file: Path.expand("../../priv/static/favicon.ico", __DIR__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment