I want to load a css module only if it exists. This is to allow end users to create an overrides.css if they want to override what I deliver. I think this is better than them modifying my css or modifying the markup to include theirs, because an update will wipe out their changes. Is there a way to conditionally load the file?
Do you have a way of determining (through some configuration) if the css module should be loaded prior to attempting to load it? Or do you want to just always try to load and see if there is a 404? Do you need notification for when the CSS was loaded? If you just need to request a stylesheet, you can do so like this: https://github.com/kriszyp/xstyle/blob/master/core/load-css.js#L103
If you need to be notified, you can use that plugin module. You could also conditionally call the load method based on some configuration information, if you have that available to you.