YUI::Loader - Load (and cache) the Yahoo JavaScript YUI framework
version 0.071
use YUI::Loader; my $loader = YUI::Loader->new_from_yui_host; $loader->include->yuitest->reset->fonts->base; print $loader->html; # The above will yield: # <link rel="stylesheet" href="http://yui.yahooapis.com/2.5.1/build/reset/reset.css" type="text/css"/> # <link rel="stylesheet" href="http://yui.yahooapis.com/2.5.1/build/fonts/fonts.css" type="text/css"/> # <link rel="stylesheet" href="http://yui.yahooapis.com/2.5.1/build/base/base.css" type="text/css"/> # <script src="http://yui.yahooapis.com/2.5.1/build/yahoo/yahoo.js" type="text/javascript"></script> # <script src="http://yui.yahooapis.com/2.5.1/build/dom/dom.js" type="text/javascript"></script> # <script src="http://yui.yahooapis.com/2.5.1/build/event/event.js" type="text/javascript"></script> # <script src="http://yui.yahooapis.com/2.5.1/build/logger/logger.js" type="text/javascript"></script> # <script src="http://yui.yahooapis.com/2.5.1/build/yuitest/yuitest.js" type="text/javascript"></script>
You can also cache YUI locally:
my $loader = YUI::Loader->new_from_yui_host(cache => { dir => "htdocs/assets", uri => "http://example.com/assets" }); $loader->include->yuitest->reset->fonts->base; print $loader->html; # The above will yield: # <link rel="stylesheet" href="http://example.com/assets/reset.css" type="text/css"/> # <link rel="stylesheet" href="http://example.com/assets/fonts.css" type="text/css"/> # <link rel="stylesheet" href="http://example.com/assets/base.css" type="text/css"/> # <script src="http://example.com/assets/yahoo.js" type="text/javascript"></script> # <script src="http://example.com/assets/dom.js" type="text/javascript"></script> # <script src="http://example.com/assets/event.js" type="text/javascript"></script> # <script src="http://example.com/assets/logger.js" type="text/javascript"></script> # <script src="http://example.com/assets/yuitest.js" type="text/javascript"></script>
YUI::Loader is a tool for loading YUI assets within your application. Loader will either provide the URI/HTML to access http://yui.yahooapis.com directly, or you can cache assets locally or serve them from an exploded yui_x.x.x.zip dir.
Return a new YUI::Loader object configured to fetch and/or serve assets from http://yui.yahooapis.com/<version>
Return a new YUI::Loader object configured to fetch/serve assets from a local, exploded yui_x.x.x.zip dir
As an example, for a dir of ./assets, the reset.css asset should be available as:
./assets
reset.css
./assets/reset/reset.css
Return a new YUI::Loader object configured to serve assets from an arbitrary uri
As an example, for a base of http://example.com/assets, the reset.css asset should be available as:
http://example.com/assets
http://example.com/assets/reset.css
Return a new YUI::Loader object configured to serve assets from an arbitrary dir
./assets/reset.css
Include each <component> in the "manifest" for the loader.
A <component> should correspond to an entry in the YUI component catalog (see below)
YUI component catalog
Returns a chainable component selector that will include what is called
You can use the methods of the selector to choose components to include. See YUI component catalog below
You can return to the loader by using the special ->then method:
$loader->include->reset->yuilogger->grids->fonts->then->html;
Returns a chainable component selector that will exclude what is called
$loader->exclude->yuilogger->then->html;
Turn on the -min filter for all included components
For example:
connection-min.js yuilogger-min.js base-min.css fonts-min.css
Turn on the -debug filter for all included components
connection-debug.js yuilogger-debug.js base-debug.css fonts-debug.css
Disable filtering of included components
connection.js yuilogger.js base.css fonts.css
Attempt to fetch a URI for <component> using the current filter setting of the loader (-min, -debug, etc.)
If the loader has a cache, then this method will try to fetch from the cache. Otherwise it will use the source.
Attempt to fetch a Path::Class::File for <component> using the current filter setting of the loader (-min, -debug, etc.)
Attempt to fetch a URI for <component> using the current filter setting of the loader (-min, -debug, etc.) from the cache
Attempt to fetch a Path::Class::File for <component> using the current filter setting of the loader (-min, -debug, etc.) from the cache
Attempt to fetch a URI for <component> using the current filter setting of the loader (-min, -debug, etc.) from the source
Attempt to fetch a Path::Class::File for <component> using the current filter setting of the loader (-min, -debug, etc.) from the source
Return a YUI::Loader::Item for <component> using the current filter setting of the loader (-min, -debug, etc.)
Return the item path for <component> using the current filter setting of the loader (-min, -debug, etc.)
Return the item file for <component> using the current filter setting of the loader (-min, -debug, etc.)
Generate and return a string containing HTML describing how to include components. For example, you can use this in the <head> section of a web page.
If the loader has a cache, then it will attempt to generate URIs from the cache, otherwise it will use the source.
Here is an example:
<link rel="stylesheet" href="http://example.com/assets/reset.css" type="text/css"/> <link rel="stylesheet" href="http://example.com/assets/fonts.css" type="text/css"/> <link rel="stylesheet" href="http://example.com/assets/base.css" type="text/css"/> <script src="http://example.com/assets/yahoo.js" type="text/javascript"></script> <script src="http://example.com/assets/dom.js" type="text/javascript"></script> <script src="http://example.com/assets/event.js" type="text/javascript"></script> <script src="http://example.com/assets/logger.js" type="text/javascript"></script> <script src="http://example.com/assets/yuitest.js" type="text/javascript"></script>
Animation Utility (utility)
AutoComplete Control (widget)
Base CSS Package (css)
Button Control (widget)
Calendar Control (widget)
Charts Control (widget)
Color Picker Control (widget)
Connection Manager (utility)
Container Family (widget)
Container Core (Module, Overlay) (widget)
Cookie Utility (utility)
DataSource Utility (utility)
DataTable Control (widget)
Dom Collection (core)
Drag & Drop Utility (utility)
Rich Text Editor (widget)
Element Utility (utility)
Event Utility (core)
Fonts CSS Package (css)
Get Utility (utility)
Grids CSS Package (css)
Browser History Manager (utility)
ImageCropper Control (widget)
ImageLoader Utility (utility)
JSON Utility (utility)
Layout Manager (widget)
Logger Control (tool)
Menu Control (widget)
Profiler (tool)
ProfilerViewer Control (tool)
Reset CSS Package (css)
Resize Utility (utility)
Selector Utility (utility)
Simple Editor (widget)
Slider Control (widget)
TabView Control (widget)
TreeView Control (widget)
Uploader (widget)
Yahoo Global Object (core)
Loader Utility (utility)
YUI Test Utility (tool)
http://developer.yahoo.com/yui/
http://developer.yahoo.com/yui/yuiloader/
JS::jQuery::Loader
Robert Krimen <robertkrimen@gmail.com>
This software is copyright (c) 2010 by Robert Krimen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install YUI::Loader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm YUI::Loader
CPAN shell
perl -MCPAN -e shell install YUI::Loader
For more information on module installation, please visit the detailed CPAN module installation guide.