kubetail-org / loadjs

A tiny async loader / dependency manager for modern browsers (899 bytes)
MIT License
2.57k stars 149 forks source link

Bug loading Google Font #74

Closed batata004 closed 5 years ago

batata004 commented 5 years ago

When loading Google Font it does not end with *.css so this library does not work cause it tries to interpret the file as JS not at CSS.

loadjs(["//fonts.googleapis.com/css?family=Montserrat|Raleway:400,700|Abel|Libre+Baskerville:400i","style.css"]);

The style.css loads fine but the google font does not load correctly and Firefox shows an error at console.

amorey commented 5 years ago

You can use a "css!" prefix to force treat a file as a stylesheet:

loadjs(["css!//fonts.googleapis.com/css?family=Montserrat|Raleway:400,700|Abel|Libre+Baskerville:400i", "style.css"]);
batata004 commented 5 years ago

A M A Z I N G! It should be on documentation, thanks a lot!

amorey commented 5 years ago

No prob! It's "#4" here: https://github.com/muicss/loadjs#documentation

batata004 commented 5 years ago

Sorry my mistake! The documentation was very clear about that, I was the curlprit cause I didnt read it all. Thanks for pointing it.