Sounds like an interesting package. Would a View Composer make sense? https://laravel.com/docs/5.8/views#sharing-data-with-all-views
New CSS for amp
Ok so I was not able to find what I was looking and thus I decided to create my own package. But I need a bit of guidance.
What I built so far.
So far I build a package that will take the rendered HTML page from blade and dump out all the ID and Class styles. Than it will take the css files added to public/css and parse it out. It than compares them and put them only the used classes and Ids in a new file called public/ampcss/style.css . As a last step it will take this file and include it in the head of html with an amp format.
Ok what I am trying to do, is to get this to run each time a view is rendered in dev mode. But in production to run only when I call it.
Why I build this. There are other packages like uncss and csspurify. I know. But you need to have node installed. The issue is that my scrip will be a clone of opencart and aimed to people that use share hosting and have no access to node. Also because what I add a new module on the home page or what ever page, i will need to run laravel mix again and again, where if you are on shared hosting you can’t.
Also because I find it stupid to need nodejs as I am building a larvel app. I wanted a native plugin.
Where I need help.
Any ideas how to set this to run with every rendered view? I think this was done as middleware if I am not mistaken. Is that correct?
Please or to participate in this conversation.