Multiverse-io / eextoheex

Automatic conversion of html.eex templates to heex
MIT License
37 stars 7 forks source link

module EEx.Tokenizer is not available #2

Closed skyqrose closed 3 years ago

skyqrose commented 3 years ago

When running with elixir 1.12.2 I got an error:

mix deps.get
mix escript.build
./eextoheex check ../myapp/lib/myapp_web/templates
** (UndefinedFunctionError) function EEx.Tokenizer.tokenize/4 is undefined (module EEx.Tokenizer is not available)
    EEx.Tokenizer.tokenize("<div>my template</div>", 1, 0, %{indentation: 0, trim: false})
    (eextoheex 0.1.0) lib/eextoheex.ex:30: EexToHeex.eex_to_heex/1
    (eextoheex 0.1.0) lib/eextoheex_cli.ex:66: anonymous fn/2 in EexToHeex.CLI.templates_helper/2
    (elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2
    (eextoheex 0.1.0) lib/eextoheex_cli.ex:65: EexToHeex.CLI.templates_helper/2
    (elixir 1.12.2) lib/kernel/cli.ex:124: anonymous fn/3 in Kernel.CLI.exec_fun/2

I fixed it by adding the :eex application to mix.exs

  def application do
    [
      extra_applications: [:logger, :briefly, :eex]
    ]
  end
hoyon commented 3 years ago

Thanks for the report!

I've pushed a commit with the suggested fix.

pmarreck commented 1 year ago

I still get this error even after performing the above fix, which is weird.

pmarreck commented 1 year ago

Fix found. EEx API had changed.

Change the EEx.Tokenizer.tokenize line to: EEx.tokenize(str, [start_line: 1, start_col: 0, trim: false, indentation: 0]) do and it should work.