iFixit / css-gather

Fetches all the CSS files off a page and dumps their CSS to stdout
MIT License
2 stars 0 forks source link

Extensive rewrite #4

Closed andyg0808 closed 3 years ago

andyg0808 commented 3 years ago

This converts the run.sh script to Ruby (renaming it to run.rb in the process) and adds support for multiple input URLs and additional CSS files which should be included regardless of whether they're needed or not. The latter feature is useful for handling parts of the page which are activated by JS and don't happen to show up during the normal penthouse run.

In the process of doing that, we added postprocessing of the critical CSS with postcss and prettier. postcss reduces the duplication across CSS, which is important when we have more than one input URL. We basically generate duplicate critical CSS for both URLs, then allow postcss to remove the duplication. prettier re-styles the output from postcss, because the optimizer config we're using would otherwise make the CSS one long string.

andyg0808 commented 3 years ago

QA :+1: This seems to have generated reasonable critical CSS.

andyg0808 commented 3 years ago

QA :+1: carryover, because I only removed an unused dependency.

djmetzle commented 3 years ago

CR :gear: