| Page 1 of 1 | [ 6 posts ] |
Morgan ChengYUI Contributor
|
Is it possible to self-host YUI3?
I want all javascript files to be downloaded from my own servers(or given CDN). I tried to put yui-min.js in my server; and have one HTML file referring to that yui-min.js file Code: <script type="text/javascript" src="yui-min.js"></script> However, Firebug shows that other YUI3 javascript resources are still loaded from Yahoo API http://yui.yahooapis.com/3.2.0/build/lo ... der-min.js http://yui.yahooapis.com/combo?3.2.0/bu ... ate-min.js Did I miss something that should be customized to make YUI3 files loaded from my own server? Thanks |
Matt ParkerYUI Contributor
|
Hi,
Yes If you want to serve them in the same way as Yahoo servers (ie using loader), you'll need a server that can do so: start here for info on the php loader http://yuilibrary.com/projects/phploader Alternatively you can use the dependency configurator http://developer.yahoo.com/yui/3/configurator/ to work out what js you need, save the file to your server, and include it as a normal js script, but of course then you don't have any of the dynamic content loading. Matt |
|
Loader should just work from your server, though as Matt says you'll want to use something like phploader to handle combo loading.
Give it an absolute path, and keep the files in the same directory structure as in the release tarball, so that you have a path like '/js/3.3.0pr1/yui/yui-min.js' in your script tags. |
|
To load files locally, you'll need to set the "base" config property, via a global YUI_config object or the config object passed to the sandbox invocation (I highly recommend the YUI_config pattern). When you get the combo loader set up locally, you can set the "comboBase" property.
Code: YUI_config = { base: "path/to/your/local/YUI3", comboBase: "path/to/local/combo" }; Here is the API reference that lists all the available config properties: http://developer.yahoo.com/yui/3/api/Loader.html |
Morgan ChengYUI Contributor
|
Thank you all for the replies.
I'm wondering how Yahoo API CDN implements the combo. If every combo request goes to PHP loader, would it bring heavy burden to CDN and bad performance? I suppose there is server side cache. |
|
Hey Morgan,
PHP Loader is similar to the one running on Y! CDN. It uses APC cache per request basics, so only the first request will be computed. On top of that, there are not too much to do, it's just a dump concat process, caching the result using the url as the key More info about it here: http://github.com/yui/phploader/ Best Regards, Caridy |
| Page 1 of 1 | [ 6 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group