Giter Club home page Giter Club logo

Comments (9)

okuryu avatar okuryu commented on August 20, 2024

Perhaps you need to re-create YUI instance by call YUI() after called YUI.add().

from yui3.

F21 avatar F21 commented on August 20, 2024

Can you explain more how that could be done? It is odd that this only occurs if I set a comboBase though. Using Yahoo's CDN does not cause this problem.

from yui3.

okuryu avatar okuryu commented on August 20, 2024

hm.. When set "comboBase": "https://yui.yahooapis.com/combo?", it's seems to works. Have you ever tried combo endpoint to work?

from yui3.

davglass avatar davglass commented on August 20, 2024

It's loading it more than once on the fiddle because it encountered an error. It's not a 200 response, so it attempts again to get it.

from yui3.

F21 avatar F21 commented on August 20, 2024

@davglass Hmm. When running on my local server using my own comboLoader, even though it receives the correct response (200), it still downloads the CSS 3 times.

When I inspect the requests in Firebug, I can confirm that indeed, the response is sent correctly and a status code of 200 was used.

from yui3.

F21 avatar F21 commented on August 20, 2024

After more investigation, I think I have found the source of the problem.

The loader needs the correct content-type. In the case of CSS, it should be text\css. For whatever reason, my loader was setting the content-type to application\javascript for everything. I think it would be nice if this caveat is noted in the docs and guides.

from yui3.

davglass avatar davglass commented on August 20, 2024

This is not a caveat, this is just good practice. It's also not
Loaders fault, the browser is failing because the content type is
wrong.

from yui3.

F21 avatar F21 commented on August 20, 2024

Perhaps caveat wasn't the right word for this, but I would still like to see this noted in the docs for loader (to explain that multiple requests to the same css files is not a bug if the content-type is incorrect). This can potentially save quite a lot of time (I actually spent a fair bit of today trying to find out why this is happening) for people using custom combo loaders.

from yui3.

davglass avatar davglass commented on August 20, 2024

I'll gladly accept a pull request for the docs, but I feel it's more
"common sense" than an issue to actually call out. A server should
return a proper content type, if not the servers a problem.

from yui3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.