开发者

What's the quickest way to generate script tags for the dependencies in a google-closure project?

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 b开发者_如何学编程ut 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?


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.


I am pretty sure you should use calcdeps.py

http://code.google.com/closure/library/docs/calcdeps.html


If you want a single javascript file to include, then use:

--output_mode=script

or

--output_mode=compiled
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜