Best practice to inject dependencies in head programmatically with a plugin

Hi, I am playing around with a custom plugin that needs to add computed css to the head of the document.
Is the approach used in the snipcart plugin (plugin-snipcart/wwPlugin.js at main · weweb-assets/plugin-snipcart · GitHub) with the injectSnipcartDependencies function a valid approach I can use to get and set the head scripts?