-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: HTML Post Processing #5
Conversation
…riticalCss jobs [WIP] #4
This is looking good so far. Some of my initial feedback. So I suggest we make a single Laravel job called something like This reduces the responsibility of each step in the optimization pipeline. All it needs to do is perform its optimizations to the file, then pass on some information to the next step. It doesn't need to worry about the filenames and it knows it has a locally stored file to deal with. This would make a difference if someone is using S3 to store the files and is using multiple queue workers. A developer should be able to configure the pipeline. Choosing which steps are run, and which aren't. They should also be able to add their own optimization steps - much like they'd add HTTP Middleware. 'optimizations' => [
\SiteOrigin\PageCache\CriticalCss::class,
\SiteOrigin\PageCache\MinifyHtml::class,
\SiteOrigin\PageCache\AutoImgixSrcset::class,
] |
src/Jobs/GenerateCriticalCss.php
Outdated
|
||
protected function injectCriticalCss($contents, $css) | ||
{ | ||
return str_replace('</head>', "<style>{$css}</style>" . PHP_EOL . "</head>", $contents); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't actually tested this, but I think this module handles injecting the new CSS while also deferring the existing stylesheets.
Oh wait, I see how you'd do this. So you'd create a base job class that handles setting the temporary filename, and then have all of these jobs inherit from that class. Then inside the main |
This reverts commit 776dab4.
@vkazakevich I actually removed all the CDN responsibility and replaced it with simple events. This allows other projects to handle an after-optimization event however they want. In the case of Briefer, we can hook into our existing CloudFlare service class. |
Resolve #4