Enonic version: 6.12.2
OS: High Sierra Version 10.13.1 (17B1003)
I’ve moved the handling of CSS to a separate application (I’m creating a design library), and inject the final CSS onto other applications by using pageContributions. But it seems that error handlers don’t uses pageContributions (I’m not getting any response at least, not even when I add pageContributions manually to the error handler response).
Is there something wrong with my setup, or does error handlers not process pageContributions? I’ve been unable to find this in the documentation.
That enabled pageContributions to be processed, but only when I add pageContributions manually to the response in the error handler. It seems it will not process pageContributions added as part of response filters.
As the response-filter is added by another application, it’s a bit difficult to refer to the CSS that needs to be injected…
To be more explicit, pageContributions will only work on pages, not controllers in general. pageContributions are made to support components leaving stuff for later processing. When it comes to responseFilters i guess we should be able to support this controllers more generally for controllers. Did you try out applying filters directly on the error.js?
Imho you should not handle css as a separate application, but rather as a library, or merge things together at build time using webpack or similar. CSS is normally tightly coupled to an app. You should only create apps if they are meaninful in a generic fashion (can run standalone, or can be added to other existing sites to add functionality). You may also go “microservice” on things and split big applications into smaller ones, but then for functionality, not for styling.
You can alway write a responseFilter in your css app that injects stuff. However, I’m unsure if the docs are right or wrong when they say responseFilters apply to “pages” - I’m unsure if it works for error.js, but it should I guess? http://xp.readthedocs.io/en/stable/developer/site/filters.html
In general I agree with you that CSS should not be handled as a separate application. But in this case the idea was to build a design system (build using Pattern Lab) and inject the resulting CSS using pageContributions. I was also planning to expose a page that simply resolved the HTML created by Pattern Lab, so that a styleguide could be exposed as a node in the content studio.
But this means I’ll change my strategy on how I handle this. It’s probably for the better anyway, for the reasons you mention.
To be explicit: I consider this issue as resolved
Yup, it didn’t seem to do any difference =/