Closed rudylattae closed 10 years ago
I didn't think of that, thanks! For the regexp, I think it should be better to match if a ?
is there otherwise of matching anything else than a .
. I'll work on that quickly ;)
I forget how that code was written. We don't care, your solution is great :p
Fixed ;)
The current snippet of code that figures out if you are trying to load a css or javascript resource is very strict.
https://github.com/pyrsmk/toast/blob/master/src/toast.js#L56
Since it expects the resource name to absolutely end in ".css" it is impossible to use other naming conventions e.g. "cache buster" like http://www.example.com/static/styles/some-facy-stuff.css?v=20131201
Kindly consider supporting such formats as they are used quite a bit.
My suggestion is that instead of using the regex
\.css$
you could use\.css[^\.]*$
. It's an example of a more relaxed regex I saw used in another loader (I forget which one so I can't properly attribute source here).The test then becomes: