NameError: uninitialized constant Middleman::PreviewServer

Hello there

I’m trying to get access to the Middleman::PreviewServer object so to get both the URL and the port assigned from the LiveReload.

Looking at the documentation, it seems I have to get access to the Middleman::PreviewServer class and objects, but when I try to reference this in the configure :development block I got an unitialized constant error.

Any idea on why is that?

Answering to myself. I finally found a good extension - Pry - through which I was able to query via the Middleman console the different components.

To get access to the host and port of LiveReload on M4 use the following:

  Middleman::LiveReloadExtension.config.host
  Middleman::LiveReloadExtension.config.port