문제

The Closure Compiler works great on .js files; something I can't figure out however is how to pass .html files to compiler.jar so that all references are preserved. Also, is it possible to pass .html files to the compiler to obfuscate <script>...</script> sections?

Many thanks, Kate.

도움이 되었습니까?

해결책

Closure Compiler can not compile javascript embedded in HTML (https://developers.google.com/closure/compiler/faq#tags)

As burnttoast11 mentioned, use exporting to preserve javascript object names you need to use in the HTML javascript (https://developers.google.com/closure/compiler/docs/api-tutorial3#export).

Lastly, the more code you can move out of HTML and into separate Javascript files, the more work closure compiler can do for you.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top