<legend id='WJgce'><style id='WJgce'><dir id='WJgce'><q id='WJgce'></q></dir></style></legend>

      <small id='WJgce'></small><noframes id='WJgce'>

        <bdo id='WJgce'></bdo><ul id='WJgce'></ul>
    1. <tfoot id='WJgce'></tfoot>
    2. <i id='WJgce'><tr id='WJgce'><dt id='WJgce'><q id='WJgce'><span id='WJgce'><b id='WJgce'><form id='WJgce'><ins id='WJgce'></ins><ul id='WJgce'></ul><sub id='WJgce'></sub></form><legend id='WJgce'></legend><bdo id='WJgce'><pre id='WJgce'><center id='WJgce'></center></pre></bdo></b><th id='WJgce'></th></span></q></dt></tr></i><div id='WJgce'><tfoot id='WJgce'></tfoot><dl id='WJgce'><fieldset id='WJgce'></fieldset></dl></div>

      1. Yii 的 AssetManager 有什么意义?

        时间:2023-08-17
            <tbody id='oQtLO'></tbody>

            <small id='oQtLO'></small><noframes id='oQtLO'>

            1. <legend id='oQtLO'><style id='oQtLO'><dir id='oQtLO'><q id='oQtLO'></q></dir></style></legend>

              <i id='oQtLO'><tr id='oQtLO'><dt id='oQtLO'><q id='oQtLO'><span id='oQtLO'><b id='oQtLO'><form id='oQtLO'><ins id='oQtLO'></ins><ul id='oQtLO'></ul><sub id='oQtLO'></sub></form><legend id='oQtLO'></legend><bdo id='oQtLO'><pre id='oQtLO'><center id='oQtLO'></center></pre></bdo></b><th id='oQtLO'></th></span></q></dt></tr></i><div id='oQtLO'><tfoot id='oQtLO'></tfoot><dl id='oQtLO'><fieldset id='oQtLO'></fieldset></dl></div>

                <bdo id='oQtLO'></bdo><ul id='oQtLO'></ul>
                <tfoot id='oQtLO'></tfoot>
                • 本文介绍了Yii 的 AssetManager 有什么意义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我找不到很多关于 Yii 的 AssetManager 用于管理 JS 和 CSS 文件的信息.我的问题是使用 AssetManager 有什么意义?我不确定它为我的开发过程增加了什么价值,事实上,它似乎使我的代码复杂化......每次我更改脚本或 css 代码时,我都必须进入并删除我的资产文件夹以确保我有最新版本.

                  I can't find much information about Yii's AssetManager for the management of JS and CSS files. My question here is what is the point of using the AssetManager? I'm not sure what value it adds to my development process, in fact, it seems like it complicates my code... every time I change my scripts or css code, I have to go in and delete my assets folder to make sure I have the latest versions.

                  似乎将所有 Javascript 文件放在/webroot/js/下并使用标签加载文件而不是通过 AssetManager 的麻烦要简单得多.另外,Yii 的 registerCoreScript 函数总是将脚本标签放在 header 标签内,而不是像 YSlow 推荐的那样将它们放在代码底部,靠近结束体标签.

                  Seems it is much simpler to just put all Javascript files under /webroot/js/ and just use the tags to load the files instead of going through the trouble of AssetManager. Plus, Yii's registerCoreScript function always places script tags inside the header tag, instead of placing them at the bottom of the code, near the closing body tag, as recommended by YSlow.

                  我觉得我对 Yii 的 AssetManager 的理解肯定有差距.任何人都知道为什么使用 AssetManager 比在 PHP 代码中硬编码脚本标签更好?我有点糊涂了...

                  I think there must be a gap in my understanding of Yii's AssetManager. Anybody have any ideas why using the AssetManager is better than hard-coding the script tags inside the PHP code? I'm a bit confused...

                  谢谢!

                  推荐答案

                  我相信有人能比我自己回答得更好,但基本上是为了让您的源代码 JS 和 CSS 文件可以保留在您的受保护文件夹.

                  I'm sure someone can answer this better than myself, but basically it's so that your source JS and CSS files can remain in your Protected folder.

                  一方面,这更安全一点,但对我来说的主要好处是您可以使用资产发布系统压缩和缩小以及以其他方式处理您的资产,并且它更容易在 CDN 上托管您的 JS 和 CSS,因为它与您的代码库是分开的.

                  This is a little more secure for one thing, but the main benefit to me is that you can compress and minify and otherwise process your assets with the asset publishing system, and it makes it easier to host your JS and CSS on a CDN since it's separate from your codebase.

                  此外,这是来自qiang的官方回复(写 Yii 的人)关于这个.

                  Also, here's an official response from qiang (the guy who wrote Yii) about this.

                  这篇关于Yii 的 AssetManager 有什么意义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Yii gridview 分页中保留复选框值 下一篇:Yii中如何使用事件

                  相关文章

                    <i id='aDplH'><tr id='aDplH'><dt id='aDplH'><q id='aDplH'><span id='aDplH'><b id='aDplH'><form id='aDplH'><ins id='aDplH'></ins><ul id='aDplH'></ul><sub id='aDplH'></sub></form><legend id='aDplH'></legend><bdo id='aDplH'><pre id='aDplH'><center id='aDplH'></center></pre></bdo></b><th id='aDplH'></th></span></q></dt></tr></i><div id='aDplH'><tfoot id='aDplH'></tfoot><dl id='aDplH'><fieldset id='aDplH'></fieldset></dl></div>

                    • <bdo id='aDplH'></bdo><ul id='aDplH'></ul>

                    <small id='aDplH'></small><noframes id='aDplH'>

                  1. <legend id='aDplH'><style id='aDplH'><dir id='aDplH'><q id='aDplH'></q></dir></style></legend><tfoot id='aDplH'></tfoot>