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:
if resources belongs to the right blog,
if locales are set or not,
if a filter needs to be applied (in the TODO) etc.
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.
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