Nested loops in config.rb and using @app.data

Hi everybody… We have been using MM for a number of years but hit issues in a recent upgrade to MM4.3.7 (that we want for enabling i18n)

Our config.rb uses lots of nested loops like this:

data.site.datatype.each do | id, c |
         puts c
      data.site.datatype.each do | id, c2 |
         puts c2
      end
    end

After the upgrade these all stopped working. After a lot of research we stubled across a solution, namely to add @app. to the data calls:

@app.data.site.datatype.each do | id, c |
         puts c
      @app.data.site.datatype.each do | id, c2 |
         puts c2
      end
    end

This does work, but causes our build time to jump from ~25 mins to … 7 hours!

Does anybody have any insights on this, namely:

  1. is using @app. a legit way of fixing this issue?
  2. Is there a trick to optimizing long build times - it seems the computer just maxes out on memory trying to juggle all the #<Middleman::Util::EnhancedHash data

I have a very cool company T-shirt for whoever can help me troubleshoot this one :wink:

Thanks!

You might want to ask this over at Github, as I don’t think the creator of Middleman is reading this forum anymore.

1 Like