I have a bit of a niche use-case.
By default, the loaded resources are simply appended to the head. I've added an append hook to short circuit that behavior in case you want to control where that resource is embedded. This is useful when you have styles that can override each other based on when they were loaded in the document.
I added a new example under
examples/control-how-element-is-appended.html
The idea is I have a css class
.super-green {
color: green;
}
The resource I am loading has a conflicting class
.super-green {
color: orange;
}
With the default behavior, anything with super-green as a class would have the color orange.
If I am able to control where it is appended to the document I can inject the loaded stylesheet above the original style declaration keeping that style in tact.
I have a bit of a niche use-case. By default, the loaded resources are simply appended to the head. I've added an
append
hook to short circuit that behavior in case you want to control where that resource is embedded. This is useful when you have styles that can override each other based on when they were loaded in the document.I added a new example under
examples/control-how-element-is-appended.html
The idea is I have a css class
The resource I am loading has a conflicting class
With the default behavior, anything with
super-green
as a class would have the colororange
. If I am able to control where it is appended to the document I can inject the loaded stylesheet above the original style declaration keeping that style in tact.