Package com.yahoo.platform.yui.compressor

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


                normalOutput(inputStream);
                return;
            }
        } else if (this.key.endsWith(".css?minify")) {
            CssCompressor compressor = new CssCompressor(in);
            compressor.compress(outWriter, MINIFY_LINEBREAKPOS);
        } else {
            // or not if not right type
            normalOutput(inputStream);
            return;
        }
View Full Code Here


                sw.append("/* ").append(file).append(" */\n");
                InputStream input = new FileInputStream(new File(getServletContext().getRealPath(file)));
                try {
                    JavaScriptCompressor compressor = new JavaScriptCompressor(
                            new InputStreamReader(input), null);
                    compressor.compress(sw, -1, false, false, false, false);
                } catch (EvaluatorException e) {
                    _logger.error(e.getMessage(), e);
                } catch (IOException e) {
                    _logger.error(e.getMessage(), e);
                } finally {
View Full Code Here

            sw.append("/* ").append(plugin.getName()).append(" */\n");
            InputStream input = plugin.getContents();
            try {
                JavaScriptCompressor compressor = new JavaScriptCompressor(
                        new InputStreamReader(input), null);
                compressor.compress(sw, -1, false, false, false, false);
            } catch (EvaluatorException e) {
                _logger.error(e.getMessage(), e);
            } catch (IOException e) {
                _logger.error(e.getMessage(), e);
            } finally {
View Full Code Here

                error(message, sourceName, line, lineSource, lineOffset);
                return new EvaluatorException(message);
            }
        });
        in.close();
        compressor.compress(out, -1, false, false, true, false);
        out.flush();
        content = baos.toByteArray();
        out.close();
    }
   
View Full Code Here

        Reader reader = toReader(resource);

        try
        {
            JavaScriptCompressor compressor = new JavaScriptCompressor(reader, errorReporter);
            compressor.compress(output, -1, true, false, false, false);
        } catch (EvaluatorException ex)
        {
            logInputLines(resource, errorLines);

            recoverFromException(ex, resource, output);
View Full Code Here

           // Get Writer object for output file
           out = openDataWriter(new File(outputFilename), UTF8);

           // Compress file
           compressor.compress(out, -1, true, false,
                   true, false);
    } finally {
      closeObject(out);
      traceVerbose("End doJSCompression");
    }
View Full Code Here

  private String compressJs(String content) {
    StringWriter writer = new StringWriter(1024);
    StringReader reader = new StringReader(content);
    try {
      JavaScriptCompressor jsCompressor = createJavaScriptCompressor(reader);
      jsCompressor.compress(writer, _compressorOptions.getLineBreakPosition(), _compressorOptions.isMunge(), _compressorOptions.isWarn(),
          _compressorOptions.isPreserveAllSemiColons(), !_compressorOptions.isOptimize());
    } catch (IOException ex) {
      s_logger.error("Unexpected IOException", ex);
    }
    return writer.toString();
View Full Code Here

            if (nocompress) {
                getLog().info("No compression is enabled");
                IOUtil.copy(in, out);
            } else if (".js".equalsIgnoreCase(src.getExtension())) {
                JavaScriptCompressor compressor = new JavaScriptCompressor(in, jsErrorReporter_);
                compressor.compress(out, linebreakpos, !nomunge, jswarn, preserveAllSemiColons, disableOptimizations);
            } else if (".css".equalsIgnoreCase(src.getExtension())) {
                compressCss(in, out);
            }
            getLog().debug("end compression");
        } finally {
View Full Code Here

  @Override
  protected void doProcess(Reader reader, Writer writer, ProcessingContext processingContext) throws Exception {

    try {
      JavaScriptCompressor compressor = new JavaScriptCompressor(reader, new YuiCompressorErrorReporter());
      compressor.compress(writer, -1, true, false, true, true);
    }
    catch (EvaluatorException e) {
      LOG.error("YUI compressor can't evaluate the content of {}", processingContext.getAsset().toLog());
      throw DandelionException.wrap(e);
    }
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.