0
votes

I want to compile some JS files inside a folder using the closure compiler, the issue I am facing is that when I am trying to compile the files in a folder(which contains JS files) whose name has got a whitespace, the closure compiler breaks and cannot recognize the path. Eg If the folder name that I want to compile is D:\New Folder, it doesn't works but if the name is D:\NewFolder it works.

The exact command I am using to run the closure in command prompt is

C:\closure-compiler>java -jar compiler.jar D:\New Folder\\*.js --js_output_file D:\Output.js

But when I run the following command it works

C:\closure-compiler>java -jar compiler.jar D:\NewFolder\\*.js --js_output_file D:\Output.js

(Where closure-compiler is the directory which contains the closure compiler jar file). I am running Closure Compiler on Windows 7 Enterprise and invoking it from the command line.

Is there a way that I* can resolve it?

1
What command are you using to compile the files?Tibos
(many) Other programs allow you to specify the path inside parenthesis. I.e somProgram -someSwitch c:/some path/file.ext would be a problem as is, and would be re-written as somProgram -someSwitch 'c:/some path/file.ext'enhzflep
You haven't posted enough information for us to help. It depends on your operating system, whether the compiler is being invoked from the command line or via a build script, etc.Chad Killingsworth
@Tibos I am using the following command to compile the files java -jar compiler.jar --js D:\New Folder*.js --js_output_file output.jsuser3012728
@ChadKillingsworth I am Windows 7 and it gives an error in both cases ie when invoked from command line as well as buildscriptuser3012728

1 Answers

0
votes

You have more than one issue affecting you:

  1. Javascript input files must be specified using the --js flag
  2. Files must be explicitly specified - wildcards are not currently supported.
  3. Directory paths with with spaces must be quoted in Windows.

Here's a corrected version of your command that worked for me in a test environment:

java -jar compiler.jar --js "d:\New Folder\input.js"
    --js_output_file D:\Output.js