HTML5 Boilerplate:script.js和plugins.js之间的区别? [英] HTML5 Boilerplate: difference between script.js and plugins.js?

查看:137
本文介绍了HTML5 Boilerplate:script.js和plugins.js之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在样板文档中找不到任何明确的答案,但是有人可以澄清plugins.js和script.js之间的区别吗?我是一名Javascript新手,很想将我所有的脚本放在一个文件中……有充分的理由不这样做吗?

i can't find any definitive answer on the boilerplate docs, but can someone clarify the difference between plugins.js, and script.js? i'm a javascript newbie, and am tempted to just put all my scripts in one file... is there a good reason not to do this?

推荐答案

来自常见问题解答:

Script.js应该包含您的主应用程序脚本.将其存储在对象文字中并执行它可能很有意义根据身体类别.

我自己用于jQuery插件和其他第三方脚本的插件.我将jQuery插件放在(function($){ ... })(jQuery);闭包内,以确保它们位于jQuery名称空间安全保护区中,特别是如果它们是由更多业余开发人员编写的.另请参见 jQuery插件创作.

Plugins I use for jQuery plugins and other 3rd party scripts myself. I put the jQuery plugins inside of the (function($){ ... })(jQuery); closure to make sure they're in the jQuery namespace safety blanket, especially if they were written by more amateur developers. See also jQuery Plugin Authoring.

这篇关于HTML5 Boilerplate:script.js和plugins.js之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆