generating multiple output files

1,991 views
Skip to first unread message

Michael

unread,
Dec 1, 2009, 12:19:15 PM12/1/09
to Closure Compiler Discuss
Hello,

I'm attempting to use the command line tool, compiler.jar (via ant),
to compile two large javascript files. These files are meant to be
used together, though one is optional, so I need to produce two
compiled files as output.

Because the code in the two files refer to one another I am under the
impression that I should compile them together, but when doing so I
can't see any way to produce two separate files as output. Is this
possible? How would I write a command line to do that?

For example this produces two files but the content of each file is
identical (presumably the combination of both inputs). I need the
content of each output file to be the compiled version of its input:

java -jar compiler.jar --js one.js --js_output_file one.cc.js --js
two.js --js_output_file two.cc.js

DotNetWise

unread,
Dec 2, 2009, 4:03:34 AM12/2/09
to Closure Compiler Discuss
Hi Michael,

You should use the amazing --module option
i.e. in my dos batch:
java -jar Build\Tools\compiler.jar ^
--compilation_level=ADVANCED_OPTIMIZATIONS ^
--externs Build\jQuery.externs.js ^
--js Build\Output\Compiling.js ^
--js Script/Themes.lang.js ^
--js Script/Themes.js ^
--module Core:3 ^
--js UI/ThemeChooser/ThemeChooser_en.htm.js ^
--js UI/ThemeChooser/ThemeChooser.js ^
--module UI_ThemeChooser:2:Core ^
--js UI/VerticalTabs/VerticalTabs_en.htm.js ^
--js UI/VerticalTabs/VerticalTabs.js ^
--module UI_VerticalTabs:2:Core ^
--js Pager/Pager_en.htm.js ^
--js Pager/jquery.Pager.js ^
--js Pager/Pager.js ^
--module Pager:3:VerticalTabs ^
--module_output_path_prefix .\Compiled\

You can see the --module argument is like this:
OutputModuleName:Number of input files to process together:Dependenent
Modules separated by commas
The OutputModuleName will be the actual OutputModuleName.js file on
the disk.
The --js_output_file is no longer needed

Hope this helps.
Laurentiu,
DotNetWise
Reply all
Reply to author
Forward
0 new messages