YUI 3 CSS styles unnecessarily included twice
Reported by Imran | September 27th, 2011 @ 03:20 AM
If you profile the files that are loaded, you will notice that
the styles for any module that references a YUI 3 widget are
included twice. The first time is loaded statically via the
<link>
tag in <head>
(minified and stitched to the others) and the second time it is
loaded dynamically via YUI's built-in Loader infrastructure. See
reference:
http://yuilibrary.com/yui/docs/tutorials/skins/#loading-skin-files
Given that it is being loaded dynamically, it is safe to remove the {css} tags from tpl files that are referencing YUI3 css files. For example in /framework/modules/text/views/text/showall_tabview.tpl it is safe to remove the following:
{css unique="id
"
link="$smarty.const.YUI3_PATH
tabview/assets/skins/sam/tabview.css"}
{/css}
And you will notice that the tabview styles are still maintained. This applies to all other tpl files that reference YUI3 css files. This will minimize the amount of css that is downloaded, and applied duplicately hopefully improving performance. YUI's loader class is commented as such:
/** * Loader dynamically loads script and css files. It includes the dependency * info for the version of the library in use, and will automatically pull in * dependencies for the modules requested. It supports rollup files and will * automatically use these when appropriate in order to minimize the number of * http connections required to load all of the dependencies. It can load the * files from the Yahoo! CDN, and it can utilize the combo service provided on * this network to reduce the number of http connections required to download * YUI files. * * While the loader can be instantiated by the end user, it normally is not. * @see YUI.use for the normal use case. The use function automatically will * pull in missing dependencies.
Comments and changes to this ticket
-
Imran October 4th, 2011 @ 07:44 PM
This is not true when the files are minified. This bug can be closed.
Thanks
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Bug Tracker for Exponent CMS