====== YUI Comporessor ====== * [[http://yui.github.io/yuicompressor/|YUI Compressor]], [[https://github.com/yui/yuicompressor|yuicompressor github]] * ''*.js'', ''*.css'' minify. * 보통 ''*.js''는 [[javascript:performance:closurecompiler|Google Javascript Closure Compiler]]로 하고 CSS만 YUI Compressor로 처리. * [[https://github.com/yui/yuicompressor/blob/master/src/com/yahoo/platform/yui/compressor/YUICompressor.java|com.yahoo.platform.yui.compressor.YUICompressor]] : 실행 main 클래스 * [[https://github.com/yui/yuicompressor/blob/master/src/com/yahoo/platform/yui/compressor/CssCompressor.java|com.yahoo.platform.yui.compressor.CssCompressor]] : CSS Comporessor * [[https://github.com/yui/yuicompressor/blob/master/src/com/yahoo/platform/yui/compressor/JavaScriptCompressor.java|com.yahoo.platform.yui.compressor.JavaScriptCompressor]] : Javascript Compressor ===== CSS Compress ===== ''YUICompressor.java''의 예를 보면 된다. // in 은 Reader 객체 CssCompressor compressor = new CssCompressor(in); // Close the input stream first, and then open the output stream, // in case the output file should override the input file. in.close(); in = null; if (outputFilename == null) { out = new OutputStreamWriter(System.out, charset); } else { out = new OutputStreamWriter(new FileOutputStream(outputFilename), charset); } // linebreakpos는 기본값이 -1 이다. 대부분 -1로 두면 될 듯. compressor.compress(out, linebreakpos); * linebreakpos 값 * ''-1'' : 줄바꿈 안함 * ''0'' : 모든 구문마다 줄바꿈