Package com.yahoo.platform.yui.compressor

Examples of com.yahoo.platform.yui.compressor.JavaScriptCompressor.compress()


            } else if (fileType.equals(FileType.HTML_FILE) || fileType.equals(FileType.XHTML_FILE)) {
                final HtmlCompressor compressor = new HtmlCompressor();
                out.write(compressor.compress(readerToString(in)));
            } else if (fileType.equals(FileType.XML_FILE)){
                final XmlCompressor compressor = new XmlCompressor();
                out.write(compressor.compress(readerToString(in)));
            }

            // close all streams
            in.close();
            in = null;
View Full Code Here


          error(message, sourceName, line, lineSource, lineOffset);
          return new EvaluatorException(message);
        }
      });

      compressor.compress(out, LINE_BREAK_POS, true, true,
          true, true);

    } catch (EvaluatorException e) {
      e.printStackTrace();
    }
View Full Code Here

          error(message, sourceName, line, lineSource, lineOffset);
          return new EvaluatorException(message);
        }
      });

      compressor.compress(out, LINE_BREAK_POS, true, true,
          true, true);

    } catch (EvaluatorException e) {
      LOG.error("YUICompressorAdaptor.compressJS Failed!", e);
    }
View Full Code Here

            return original;

        try {
            StringWriter result = new StringWriter();
            JavaScriptCompressor compressor = new JavaScriptCompressor(new StringReader(original), yuiErrorReporter);
            compressor.compress(result, -1, true, false, false, false);
            result.flush();
            return result.toString();
        } catch (IOException e) {
            log.error("Error compressing javascript with yui-compressor! Returning original javascript", e);
        }
View Full Code Here

    protected void doMinimize(Reader input, Writer output) throws IOException
    {
        JavaScriptCompressor compressor = new JavaScriptCompressor(input, errorReporter);

        compressor.compress(output, -1, true, false, false, false);
    }
}
View Full Code Here

    public String compressJavaScript(String script) throws IOException
    {
        StringReader stringReader = new StringReader(script);
        JavaScriptCompressor yuiJavaScriptCompressor = new JavaScriptCompressor(stringReader, new YahooJSErrorReporter());
        StringWriter stringWriter = new StringWriter();
        yuiJavaScriptCompressor.compress(stringWriter, (Integer) compressorParameters.get(PARAMETER_LINEBREAK), (Boolean) compressorParameters.get(PARAMETER_MUNGE),
                (Boolean) compressorParameters.get(PARAMETER_VERBOSE), (Boolean) compressorParameters.get(PARAMETER_PRESERVE_ALL_SEMICOLONS),
                (Boolean) compressorParameters.get(PARAMETER_DISABLE_OPTIMIZATIONS));
        String compressedScript = stringWriter.toString();
        return compressedScript;
    }
View Full Code Here

                case YUI:
                    log.debug("Using YUI Compressor engine.");

                    JavaScriptCompressor compressor = new JavaScriptCompressor(reader, new JavaScriptErrorReporter(log,
                            mergedFile.getName()));
                    compressor.compress(writer, yuiConfig.getLineBreak(), yuiConfig.isMunge(), verbose,
                            yuiConfig.isPreserveSemicolons(), yuiConfig.isDisableOptimizations());
                    break;
                default:
                    log.warn("JavaScript engine not supported.");
                    break;
View Full Code Here

              out = new OutputStreamWriter(new FileOutputStream(
                  copyToFile), "UTF-8");
              errorReport.setDefaultFileName(srcFile.getName());
              JavaScriptCompressor compressor = new JavaScriptCompressor(
                  in, errorReport);
              compressor.compress(out, -1, true, false, false,
                  false);
              // zk modified here
            } catch (EvaluatorException e) {
              error = true;
            } finally {
View Full Code Here

              out = new OutputStreamWriter(new FileOutputStream(
                  copyToFile), "UTF-8");

              CssCompressor compressor = new CssCompressor(in);
              compressor.compress(out, -1);

              // zk modified here
            } finally {
              if (in != null) {
                in.close();
View Full Code Here

        boolean preserveAllSemiColons = false;
        boolean disableOptimizations = false;
        boolean verbose = false;
        int linebreakpos = 0;

        compressor.compress(out, linebreakpos, munge, verbose,
            preserveAllSemiColons, disableOptimizations);
        out.close();
        String result = out.toString();
        if( logger.isDebugEnabled() ) {
          timer.stop();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.