Process CSS after the whole site is written to disk #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modifies the plugin to register the hook on the
:post_writeevent of the:site, instead of the:post_writeevent of the:pages, to make sure that PostCSS processing is executed after the whole site is written to disk.Previously, when using Tailwind CSS, for example, several classes would not be detected and added to the output CSS on first build because the source CSS file was processed in between the rest of the pages of site, so the subsequent pages would have missing styles, thus requiring two build steps to deploy to GitHub Pages. With these changes, CSS files marked with Front Matter are processed by this plugin after the whole site is written to disk, which ensures that all Tailwind CSS classes are detected, processed, and added to the output file. These fixes should fix similar problems with other PostCSS plugins but I haven't tested that.
I think this should close issue #2
Thanks to @bglw for creating this plugin. Hope you have some spare time to review and approve this PR.