Examples of UglifyJs


Examples of ro.isdc.wro.extensions.processor.support.uglify.UglifyJs

   */
  @Override
  public void process(final Resource resource, final Reader reader, final Writer writer)
    throws IOException {
    final String content = IOUtils.toString(reader);
    final UglifyJs engine = enginePool.getObject();
    try {
      final String filename = resource == null ? "noName.js" : resource.getUri();
      writer.write(engine.process(filename, content));
    } catch (final WroRuntimeException e) {
      onException(e);
      final String resourceUri = resource == null ? StringUtils.EMPTY : "[" + resource.getUri() + "]";
      LOG.warn("Exception while applying " + getClass().getSimpleName() + " processor on the " + resourceUri
        + " resource, no processing applied...", e);
View Full Code Here

Examples of ro.isdc.wro.extensions.processor.support.uglify.UglifyJs

  }

  @Test
  public void shouldBePossibleToExtendLessCssWithDifferentScriptStream()
      throws Exception {
    new UglifyJs(UGLIFY) {
      @Override
      protected InputStream getScriptAsStream() {
        return UglifyJs.class.getResourceAsStream(UglifyJs.DEFAULT_UGLIFY_JS);
      }
    }.process("filename", "alert(1);");
View Full Code Here

Examples of ro.isdc.wro.extensions.processor.support.uglify.UglifyJs

  }

  @Test(expected = NullPointerException.class)
  public void cannotAcceptNullOptions()
      throws Exception {
    new UglifyJs(UGLIFY) {
      @Override
      protected String createOptionsAsJson()
          throws IOException {
        return null;
      };
View Full Code Here

Examples of ro.isdc.wro.extensions.processor.support.uglify.UglifyJs

  }

  @Test(expected = WroRuntimeException.class)
  public void cannotAcceptInvalidJsonOptions()
      throws Exception {
    new UglifyJs(UGLIFY) {
      @Override
      protected String createOptionsAsJson()
          throws IOException {
        return "This is an invalid JSON";
      };
View Full Code Here

Examples of uglify.UglifyJS

    File[] sources = findSourceFiles();

    if (sources != null) {
      log("Compiling " + sources.length + " file(s)");
     
      UglifyJS uglifyjs = new UglifyJS();
     
      ArrayList<String> options = createUglifyOptions();

      for (File source : sources) {
       
        options.add(source.getAbsolutePath());

        String[] args = new String[options.size()];

        args = options.toArray(args);

        if (this.outputFile == null) {
         
          uglifyjs.exec(args);
         
        } else {

          String result = uglifyjs.uglify(args);
          if (result != null) {
            writeResult(result);
          } else {
            throw new BuildException("uglify failed.");
          }
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.