theKashey / used-styles

📝All the critical styles you've used to render a page.
MIT License
137 stars 9 forks source link

Inline full files and exclude them from loading twice #24

Open wille opened 3 years ago

wille commented 3 years ago

Need ability to inline complete .css files and exclude those files from the extracted list of css files. so it's not loaded twice.

theKashey commented 3 years ago

Related: #14, #13

There is a way how to exclude certain files during the initialisation phase - discoverProjectStyles, just return false from filter

You might create two workers - one "without" files you want to inline completely, and another "without" normal files.

Keep in mind - used-styles might report which files has to be added(getUsedStyles), but not able to inline them by itself. Inlining work only for rules.