为 google-closure 项目中的依赖项生成脚本标签的最快方法是什么?
我正在学习 JavaScript 和 Google Closure,显然(一旦您开始使用模板和库的各个部分),手动管理依赖项就变得很困难。
我知道该库提供了一些 python 脚本来帮助解决此问题,但我不太清楚使用它们的最佳方法。
(我知道最终我会将其全部编译成一个“最小化”文件,但为了开发和我自己的理解,我觉得我需要先解决这一点!)
我最接近的是使用“closurebuilder.py”脚本按依赖顺序生成文件列表...
closure-library/closure/bin/build/closurebuilder.py
--root=MyProjectFolder
--root=ClosureLibraryFolder
--root=ClosureTemplateFolder
--namespace=MyProjectNamespace
--output_mode=list
--output_file=my-dependencies.txt
...但是我仍然需要手动将每个文件包装在脚本标记中并将它们粘贴到我的 html 中。我错过了什么吗?有没有更直接的方法来做到这一点?
I'm learning JavaScript and Google Closure, and obviously (once you start using templates and various parts of the library) it becomes difficult to manage the dependencies by hand.
I know that the library provides some python scripts to help with this but I can't quite figure out the best way to use them.
(I know that eventually I'll be compiling it all into a single 'minimized' file but for development and my own understanding I feel I need to get my head round this bit first!)
The closest I've got is to use the "closurebuilder.py" script to produce a list of files in dependency order...
closure-library/closure/bin/build/closurebuilder.py
--root=MyProjectFolder
--root=ClosureLibraryFolder
--root=ClosureTemplateFolder
--namespace=MyProjectNamespace
--output_mode=list
--output_file=my-dependencies.txt
...but I then still need to manually wrap each one in a script tag and paste them into my html. Am I missing something? Is there a more straightforward way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您刚刚开始,您可能会发现 Michael Bolin 的 Plovr (http://www.plovr.com/) 很有用,因此您无需费力地进行设置。
If you are just getting started, you might find Michael Bolin's Plovr (http://www.plovr.com/) useful so you don't need to futz with your setup.
我很确定您应该使用 calcdeps.py
http://code.google.com /closure/library/docs/calcdeps.html
I am pretty sure you should use calcdeps.py
http://code.google.com/closure/library/docs/calcdeps.html
如果您想要包含单个 javascript 文件,请使用:
或
If you want a single javascript file to include, then use:
or