Last active
December 28, 2015 03:48
-
-
Save matheusca/7437435 to your computer and use it in GitHub Desktop.
This file contains 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
defmodule Weber.Controller do | |
defmacro __using__(_) do | |
quote do | |
@before_compile { unquote(__MODULE__), :purge_files} | |
import Weber.Controller.Layout | |
layout('main.html') | |
end | |
end | |
defmacro purge_files(_) do | |
{ :ok, root } = File.cwd | |
if System.get_env("MIX_ENV") != "prod" do | |
Weber.Reload.start_link(root) | |
Weber.Reload.enable | |
if Code.ensure_loaded?(IEx) and IEx.started? do | |
IEx.after_spawn(fn -> Weber.Reload.enable end) | |
end | |
Weber.Reload.purge | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment