slim: Slim 5 no longer working with Middleman: "NameError: uninitialized constant #::ActionView"

I tried using Slim 5 with Middleman and got an error when I visited a page (not when Middleman boots, but when it attempts to render a template).

Slim 4 works fine.

$ bundle exec middleman
== The Middleman is loading
== View your site at "http://192.168.0.113:4567"
== Inspect your site configuration at "http://192.168.0.113:4567/__middleman"
# (At this point I visit a page)
NameError: uninitialized constant #<Class:0x0000000106bf2320>::ActionView
        /Users/henrik/Projects/henrik.nyh.se/source/uses.html.slim:1:in `__tilt_7340'
        /Users/henrik/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/tilt-2.0.11/lib/tilt/template.rb:181:in `call'
        /Users/henrik/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/tilt-2.0.11/lib/tilt/template.rb:181:in `evaluate'
        /Users/henrik/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/tilt-2.0.11/lib/tilt/template.rb:109:in `render'
        /Users/henrik/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/middleman-core-4.4.3/lib/middleman-core/renderers/slim.rb:6:in `render'
        /Users/henrik/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/padrino-helpers-0.15.2/lib/padrino/rendering.rb:17:in `render'
        /Users/henrik/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/middleman-core-4.4.3/lib/middleman-core/file_renderer.rb:79:in `render'
…

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 20 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Looks like https://github.com/middleman/middleman/issues/2619 is the appropriate place to continue the discussion?

Isn’t it possible to solve it rather than documenting it? It is very rare that users are requested to “bring their own indirect dependencies”, especially when it will not work without them.

@DannyBen

Isn’t it possible to solve it rather than documenting it? It is very rare that users are requested to “bring their own indirect dependencies”, especially when it will not work without them.

Slim doesn’t depend on Rails, but provides integration. We cannot depend on it here. If you want to solve the dependency issue, it must be done in Middleman.

Maybe let middleman choose a buffer type based on whether rails is available or not?

I agree. Why does middleman depend on rails in the first place? That makes no sense to me.