CSS files via Fusion

Is there a way and possibly examples for generating CSS files

//domain.tld/main.css

using Fusion?

  1. for http access directly from a browser
  2. for (CLI) access through a bundler
1 Like

Should be very similar procedure as we did for the robots.txt. See here neos-seo/RobotsTxt.fusion at master · neos/neos-seo · GitHub

1 Like

Beautiful!
You’re using the route’s request format to set the root renderer.

These questions arise for me now:

  1. Will / can the whole Fusion rendition be cached and also single prototype results,
    so when of the many CSS components that go into the final css file response,
    one part rendered by a particular prototype changes, the rest doesn’t need to be reevaluated?
  2. How would I put the result through a minifier at the last step, before the final Fusion value is put into cache and sent to the browser?
    Is there a way to do this with EEL or rather a dedicated FusionObject class?

I‘m not quite sure how you mean 1.
I don‘t think it‘s possible to make that css based on your page and its prototypes. At least it will not be very performant when every page has its own CSS file.

What I did in my Plugin was to render the inline css for each component and have a middleware that concatenation them at the end and removes duplicates.

Regarding 2 . you can have a Eel helper as process that will do some PHP based minification. Or a Fusion object with implementation. Doesn‘t really matter at the end.