通过避免使用 mootool 来减少 Joomla 1.7 上的加载时间

发布于 2024-12-20 06:29:00 字数 306 浏览 4 评论 0原文

我们如何避免在首页加载mootools,同时仍然允许它在需要mootools的页面上加载?

在最近的一个项目中,我们使用 Joomla 1.7,现阶段我们使用默认模板之一。似乎 mootools(核心及更多)总是被加载,导致首页大小达到 500+ KB,其中 mootools 是该大小的主要部分。我们希望避免使用 mootools,至少在首页上,但我们知道某些模块可能需要 mootools。

我的印象是 mootools 应该只在模块需要时才加载。这是真的吗?我在哪里可以找到使用 mootools 的标准模块的概述?因为这样我们就可以避免那些出现在首页的内容。

How do we avoid loading mootools on the frontpage, while still allow it to load on pages where mootools is required?

In a recent project we are using Joomla 1.7 and at this stage we are using one of the default templates. It seems that mootools (core & more) is always loaded, bumping the frontpage up to 500+ Kbytes where the mootools are the major part in that size. We want to avoid mootools, at least on the frontpage, while we are aware that some modules might need the mootools.

I have the impression that mootools shouls only be loaded when the modules require it. Is that true and where do I find an overview of which standard modules that are using mootools? Because then we can avoid those on the frontpage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

苦行僧 2024-12-27 06:29:00

即使您正在使用的模板也可能需要 Mootools。

加载 mootools 的正确方法是使用这个:

JHTML::_( 'behavior.mootools' );

所以你应该在你正在使用的模块、组件、插件和模板中搜索它。无论如何,如果您使用 mootools 的压缩版本并使用 gzip 压缩输出,您应该会看到 kb 量确实下降了。

我希望它有帮助!

It is possible that even the template you are using requires Mootools.

The right way to load mootools is using this:

JHTML::_( 'behavior.mootools' );

So you should search for that in the modules, components, plugins and template you are using. Any way, if you use the compressed version of mootools and use gzip compression for the output, you should see the amount of kb really go down.

I hope it helped!

清秋悲枫 2024-12-27 06:29:00

Joomla 默认加载 mootools;无论如何,总是在需要的时候。我相信有一些插件可以在您想要的地点/时间/方式下关闭 mootools。请参阅此帖子: http://forum.joomla.org/viewtopic.php?p=2516614 - 他们讨论禁用它并给出了各种方法来实现它;以及讨论这样做的缺点。
这是一个可以满足您需求的插件: http://extensions.joomla .org/extensions/core-enhancements/scripts/15748

Joomla loads mootools by default; always when it needs it anyway. I believe there are plugins available to turn off mootools where/when/how you want. See this thread: http://forum.joomla.org/viewtopic.php?p=2516614 - they discuss disabling it and give various ways to go about it; as well as discussing the downfalls of doing so.
Here is a plugin that does what you want as well: http://extensions.joomla.org/extensions/core-enhancements/scripts/15748

孤星 2024-12-27 06:29:00

上方添加以下代码

$header = $this->getHeadData();
$header['scripts'] = array('/my-js.js'=> array ('mime' =>'text/javascript','defer'=>'','async'=>''));
$this->setHeadData($header);

Add the following code above the <jdoc:include type="head" />

$header = $this->getHeadData();
$header['scripts'] = array('/my-js.js'=> array ('mime' =>'text/javascript','defer'=>'','async'=>''));
$this->setHeadData($header);
﹉夏雨初晴づ 2024-12-27 06:29:00

只需禁用 mootools 升级插件即可。

Just disable the mootools upgrade plugin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文