문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 | 마지막 판 양쪽 다음 판 | ||
gradle:javascript [2012/10/23 16:23] kwon37xi |
gradle:javascript [2012/10/23 17:57] kwon37xi |
||
---|---|---|---|
줄 7: | 줄 7: | ||
* https:// | * https:// | ||
- | ====== Closure Compiler API ====== | ||
- | * [[https:// | ||
- | <code groovy> | ||
- | void minifyJsFile(final Set< | ||
- | final String warningLevel, | ||
- | Compiler compiler = new Compiler() | ||
- | CompilationLevel.valueOf(compilationLevel).setOptionsForCompilationLevel(options) | ||
- | WarningLevel level = WarningLevel.valueOf(warningLevel) | ||
- | level.setOptionsForWarningLevel(options) | ||
- | List< | ||
- | if (externsFiles.size()) { | ||
- | externs.addAll(externsFiles.collect() { JSSourceFile.fromFile(it) }) | ||
- | } | ||
- | List< | ||
- | inputFiles.each { inputFile -> | ||
- | inputs.add(JSSourceFile.fromFile(inputFile)) | ||
- | } | ||
- | Result result = compiler.compile(externs, | ||
- | if (result.success) { | ||
- | outputFile.write(compiler.toSource()) | ||
- | } else { | ||
- | result.errors.each { | ||
- | println " | ||
- | } | ||
- | } | ||
- | } | ||
- | </ |