javascript 如何使用 HTML5 Boilerplate 中的 main.js 和 plugins.js?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19134679/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I use main.js and plugins.js from HTML5 Boilerplate?
提问by
There is a similar questionthat has an accepted answer, but the link it refers to is no longer available (not even on the wayback machine). The H5BP docs themselves are not very specific on this subject (here), at least not for a noob like me. And the answer to this similar questionstill doesn't explain much to me. It sort of touches on how to use plugins.js, but isn't very specific and doesn't explain main.js.
有一个类似的问题有一个公认的答案,但它所指的链接不再可用(甚至在回程机上也不可用)。H5BP 文档本身在这个主题上不是很具体(这里),至少不是像我这样的菜鸟。而这个类似问题的答案对我来说仍然没有太多解释。它有点涉及如何使用 plugins.js,但不是很具体,也没有解释 main.js。
Unfortunately, these are the only bits of information I could find, and I still don't really understand what these files are for. So can anyone explain;
不幸的是,这些是我能找到的唯一信息,我仍然不明白这些文件的用途。谁能解释一下;
How do I use main.js and plugins.js from the HTML5 boilerplate?
如何使用 HTML5 样板文件中的 main.js 和 plugins.js?
What is their function, how would I use them?
它们的功能是什么,我将如何使用它们?
采纳答案by roblarsen
It's just suggested organization.
这只是建议的组织。
The idea is to drop jQuery plugins you're using into plugins.js
and (depending on the size of the site) do your work in main.js
.
这个想法是将您正在使用的 jQuery 插件放入plugins.js
并(取决于站点的大小)在main.js
.
I wrote it up in detail in the Isboar standards docs(although that doc refers to scripts.js
and not main.js
)
我在Isboar 标准文档中详细地写了它(尽管该文档指的是scripts.js
而不是main.js
)
回答by user2836265
plugins.js is to put all your vendor scripts (not authored by you), in a single file. You may have tooltio.1.4.js or tablular.min.js or d3.vert.js - and instead of using all these JS files directly into HTML page, you copy paste all codes into plugins.js
plugins.js 是将所有供应商脚本(不是您编写的)放在一个文件中。您可能有 tooltio.1.4.js 或 tablular.min.js 或 d3.vert.js - 而不是将所有这些 JS 文件直接使用到 HTML 页面中,而是将所有代码复制粘贴到 plugins.js
Main.js is just a template file given to you for your own authored codes.
Main.js 只是提供给您的模板文件,用于您自己编写的代码。
回答by Elise Chant
You should refer to h5bp's other repos'. Check this out https://github.com/h5bp/html5boilerplate.com/blob/master/src/js/main.js
您应该参考 h5bp 的其他存储库。看看这个https://github.com/h5bp/html5boilerplate.com/blob/master/src/js/main.js