Tom-Bonnike / netlify-plugin-inline-critical-css

A Netlify plugin to inline your critical CSS, built on top of the `critical` package.
https://www.npmjs.com/package/netlify-plugin-inline-critical-css
MIT License
66 stars 5 forks source link

Support a file and directory filter #17

Closed seancdavis closed 3 years ago

seancdavis commented 3 years ago

This adds support for setting the fileFilter and directoryFilter in the project's netlify.toml file.

I also added a .prettierrc file with settings that it seemed like you're using. And I ran npm install, which is why there are changes to package-lock.json. I kept both of these changes as their own commits in case you wanted to remove them.

Tom-Bonnike commented 3 years ago

Thanks Sean! Good work! I’ll release that on NPM asap. I’ll need to make a PR to https://github.com/netlify/plugins so the new version is used when installing via the Netlify UI.

Do you have public netlify build logs by any chance? Would love if we could use a deploy of your website as an example of a successful deploy with the new version (see Test plan in this PR).

seancdavis commented 3 years ago

@Tom-Bonnike Woohoo — thanks for merging!

There is a log using my fork (which is the same code here) for the most recent build on my site. My netlify.toml file uses index.html as the fileFilter and ["!*"] as the directoryFilter, which then only processed the home page.

This effectively took my builds from about 7 minutes down to 2 minutes, where this plugin only ran for a few seconds.

Tom-Bonnike commented 3 years ago

Ended up making some minor changes so I tested with my own website. You can follow https://github.com/netlify/plugins/pull/215 to know when you can get rid of the forked plugin your netlify.toml :)