middleman / middleman-blog

Blog Engine Extension for Middleman
https://middlemanapp.com
MIT License
325 stars 179 forks source link

Dependency Injection for manipulate_resource_list #306

Closed charly closed 8 years ago

charly commented 8 years ago

Hi,

I started using middleman a couple of weeks ago and absolutely love it.

But one thing bothers me : MyExtension#manipulate_resource_list is concerned with the totality of the resources and breaks SRP quit badly.

For example in the Paginator of middleman-blog, the method needs to check:

This clearly should not be the paginator's concern !!! I mean... this is really bad ! So I understand, at least I assume, middleman extensions are build on the same idea rack middlewares are and each extension/middleware passes the whole set of resources/headers to the next...

So I don't have any out of the box solution, and I don't know if DI could be it in this case, but I would be interested to know if this problem has been spotted/addressed already, if there are plans or ways to solve it, and if not I would be happy to try to contribute.

Best, Charly

charly commented 8 years ago

Moving the question to middleman-core, probably more adequate!