I want to comment the follows heex file's span line according to the method in elixir forum
When recompile. The error message is as follows:
macbook:pen yuchen$ mix compile
Compiling 1 file (.ex)
== Compilation error in file lib/pen_web/views/login_view.ex ==
** (Phoenix.LiveView.HTMLTokenizer.ParseError) lib/pen_web/templates/login/show.html.heex:11:42: expected closing `"` for attribute value
Make sure the attribute is properly closed. This may also happen if
there is an EEx interpolation inside a tag, which is not supported.
Instead of
<div <%= @some_attributes %>>
</div>
do
<div {@some_attributes}>
</div>
Where @some_attributes must be a keyword list or a map.
(phoenix_live_view 0.17.11) lib/phoenix_live_view/html_tokenizer.ex:487: Phoenix.LiveView.HTMLTokenizer.handle_attr_value_quote/7
(phoenix_live_view 0.17.11) lib/phoenix_live_view/html_engine.ex:122: Phoenix.LiveView.HTMLEngine.handle_text/3
(eex 1.13.4) lib/eex/compiler.ex:49: EEx.Compiler.generate_buffer/4
(eex 1.13.4) lib/eex/compiler.ex:82: EEx.Compiler.generate_buffer/4
(phoenix_view 1.1.2) lib/phoenix/template.ex:419: Phoenix.Template.compile/3
(phoenix_view 1.1.2) lib/phoenix/template.ex:197: anonymous fn/4 in Phoenix.Template."MACRO-__before_compile__"/2
(elixir 1.13.4) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix_view 1.1.2) expanding macro: Phoenix.Template.__before_compile__/1
** (exit) shutdown: 1
(mix 1.13.4) lib/mix/tasks/compile.all.ex:78: Mix.Tasks.Compile.All.compile/4
(mix 1.13.4) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
(mix 1.13.4) lib/mix/tasks/compile.all.ex:36: Mix.Tasks.Compile.All.run/1
(mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
(mix 1.13.4) lib/mix/tasks/compile.ex:131: Mix.Tasks.Compile.run/1
(mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
(iex 1.13.4) lib/iex/helpers.ex:107: IEx.Helpers.recompile/1
show.html.heex file is as follows:
<h2>Log in</h2>
<%= form_tag(Routes.login_path(Endpoint, :create)) do %>
<div class="form-group">
<label for="username">Username or Email</label>
<input id="username" type="text" class="form-control" name="username">
</div>
<div class="form-group">
<label for="password">Password</label>
<.ignore>
<span style="float: right;"><a href="<%= Routes.password_reset_path(Endpoint, :show) %>">Forgot your password?</a></span>
</.ignore>
<input id="password" type="password" class="form-control" name="password">
</div>
<button type="submit" class="btn btn-primary">Log in</button>
<br><br>
<% end %>
heexIgnore file is as follows:
defmodule PenWeb.HeexIgnore do
use Phoenix.Component
def ignore(assigns), do: ~H""
end
Pen_web.ex file is as follows:
defp view_helpers do
quote do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
# Import LiveView and .heex helpers (live_render, live_patch, <.form>, etc)
import Phoenix.LiveView.Helpers
# Import basic rendering functionality (render, render_layout, etc)
import Phoenix.View
import PenWeb.ErrorHelpers
import PenWeb.Gettext
alias PenWeb.Router.Helpers, as: Routes
alias PenWeb.{Endpoint, Router}
import PenWeb.HeexIgnore
end
end