Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slime generator #157

Closed
juanvico opened this issue Apr 26, 2020 · 0 comments · Fixed by #156
Closed

Fix slime generator #157

juanvico opened this issue Apr 26, 2020 · 0 comments · Fixed by #156
Labels

Comments

@juanvico
Copy link

Issue:

Running mix torch.gen.html Blog Post posts title:string body:text --format slim does not generate any files and produces the following output:

** (File.Error) could not read file "PROJECT_DIR/_build/dev/lib/torch/priv/templates/slim/phx.gen.html/controller_test.exs": no such file or directory
    (elixir) lib/file.ex:353: File.read!/1
    lib/mix/torch.ex:48: anonymous fn/3 in Mix.Torch.copy_from/2
    (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/mix/torch.ex:44: Mix.Torch.copy_from/2
    (elixir) lib/enum.ex:783: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:783: Enum.each/2
    lib/mix/tasks/torch.gen.html.ex:23: Mix.Tasks.Torch.Gen.Html.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3

Cause:

Torch looks for the files to be generated inside priv/templates/#{format}/phx.gen.html, but the only file in this folder is layout.html.slim. With @brunvez we've opened #156 which addresses this.

What we did was create the missing template files so that they could be copied over by the slime generator. We had to make the slime templates with an .html.eex extension in order to the slime generator to be able to actually find them. You may also see those changes in Mix.Torch where we had to hardcode the format.

We also changed the format setting to be slime since the generator and the file extension had the same name.

Anyway, we hope this is useful and that you plan to keep supporting slime as a template engine. Any feedback and comments are much welcomed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants