pyrsmk / toast

A modern JS/CSS asset loader, written in TypeScript.
MIT License
118 stars 13 forks source link

load external resource like google webfonts #13

Closed CanRau closed 8 years ago

CanRau commented 8 years ago

Hey, just wanted to load a google webfont using toast but it fails Error Uncaught TypeError: Cannot read property '1' of null which refers to this line b=/(^.+\.\w+)(\?.*)?$/.exec(resource)[1];

Normally I used loadCSS from FilamentGroup but in this project I'm already using toast so why including two resource loaders.. I haven't actually looked into the source in this case and only tested with the webfont so maybe external sources are working in general..

Would love to use toast for loading the font asynchronously :+1: :D

Cheers

pyrsmk commented 8 years ago

Toast was not designed to load other things than js or css, which is detecting by parsing the filename of the resource to load. I think I can find a way of specifying the type of the resource when toast cannot detect it (like a google font). Maybe :

toast('[css]https://fonts.googleapis.com/css?family=Open+Sans');

edit : if your code worked before the release, that was a bug by itself :p

CanRau commented 8 years ago

I never tried it before, till now I only used toast to load a polyfill if modernizr says it's needed ;-)

That would be great :D

pyrsmk commented 8 years ago

This is fixed with the upcoming release. You'll be able to update in 15 minutes ;)

CanRau commented 8 years ago

Wow that was fast! Thank you :dancers:

EDIT: That was the fastest support ever! And it just works :)