closure compiler output on the same file not working.

545 views
Skip to first unread message

Ash

unread,
Dec 22, 2011, 2:20:57 AM12/22/11
to Closure Compiler Discuss
I try to override my source file with compiled version at build time.

>java -jar compiler.jar --js test.js --js_output_file test.js

the above command succeed but the content of test.js gets wipped out.
If I output to a different file then it works.

What should i do to make it override the same file with minified
version?

zuxiong lin

unread,
Dec 22, 2011, 4:29:17 AM12/22/11
to closure-comp...@googlegroups.com
Why do you need the same filename.? 
Best paractice is  --js_output_file test.min.js

2011/12/22 Ash <agi...@gmail.com>

Alan Leung

unread,
Dec 22, 2011, 4:35:19 AM12/22/11
to closure-comp...@googlegroups.com
I would say the more desirable behavior would be not overwritting the input file and throws an error message.

I've accidently overwrite the input too many times.

What type of build system do you use? Can't you use compile to test.js.tmp and then "mv test.js.tmp test.js" after?

zuxiong lin

unread,
Dec 22, 2011, 4:38:46 AM12/22/11
to closure-comp...@googlegroups.com
build system  ???
You mean shell or bat ? 

2011/12/22 Alan Leung <acl...@google.com>

vit...@gmail.com

unread,
Apr 19, 2012, 8:38:07 AM4/19/12
to closure-comp...@googlegroups.com
Example based on my setup:
copy PROJECT_DIR to PROJECT_DIR_MIN
compress every *.js in PROJECT_DIR_MIN
compile PROJECT_DIR_MIN project.bar
deploy_to_device project.bar

No need to make changes to <script> in the index.html (i.e. add the ".min" part) == No frustrating work, TIME SAVED :D

Possible?

mikegleasonjr

unread,
May 28, 2012, 3:38:04 PM5/28/12
to Closure Compiler Discuss
I agree, if I want to overwrite my own files it is my problem. (The
minification is made by my CI system before my js tests are run. No
need to modify my <script> tags).

I have a versionning system if I commit a minified file ;)

So is it possible ?

beninm...@gmail.com

unread,
Feb 25, 2014, 11:17:56 PM2/25/14
to closure-comp...@googlegroups.com
+1 I would really like to see this feature. 
Reply all
Reply to author
Forward
0 new messages