Search code examples
environmentmiddleman

Where has development? and build? gone in middleman v4


In version 3.0 of middleman, you've been able to use the variables development? and build? in templates. In version 4.0 these variables no longer exist.

How do I identify which environment middleman is currently running in?


Solution

  • Middleman v4.0 uses a new method of identifying which environment it is currently running in. This is because you can now have more than two environments.

    Old syntax:

    <% if development? %>
        ...
    <% end %>
    

    New syntax:

    <% if config[:environment].eql?(:development) %>
        ...
    <% end %>