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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自 常见问题解答:
From the FAQ:
在
plugins.js
文件中,您捆绑了很少的帮助程序,它可能意味着包含您根本不会修改的内容(或至少不会经常修改),而script.js
是一个可供您使用的文件...是的,脚本。 ;)你所说的是真的 - 在生产中,通常最好为浏览器提供一个文件而不是多个文件。然而,在开发过程中,将事物分开会更容易。
这就是为什么样板附带一个构建脚本的原因,它将所有脚本组合成一个,因此您不必担心这一点。
in
plugins.js
file you get few helpers bundled, it's probably meant to include stuff you won't modify at all (or at least not so often), whilescript.js
is a file ready for your... yes, scripts. ;)what you said is true - in production, it's usually better to serve the browser one file instead of many. however in development it's easier to keep things separated.
that's the reason why boilerplate comes with a build script, which combines all your scripts into one so you don't have to worry about this.
在脚本中 ->您的自定义脚本
在插件中->别碰它!
在构建过程中,两个文件合并成一个唯一的压缩文件......
in scripts -> your custom scripts
in plugings -> don't touch it!
In build process both files unite into one unique and compressed file...