Package de.matrixweb.smaller.resource

Examples of de.matrixweb.smaller.resource.Resource


      try {
        URL imgurl = null;
        if (url.startsWith("http://")) {
          imgurl = new URL(url);
        } else {
          Resource img = this.resource.getResolver().resolve(url);
          imgurl = img.getURL();
          if (imgurl == null) {
            // Note: This fixes absolute urls which are relative to the servlet
            // root (e.g. '/some/where.png')
            // CssEmbed always prepends none absolute urls (not starting with
            // http:) with the given root string
            img = this.resource.getResolver().resolve(originalUrl);
            imgurl = img.getURL();
          }
        }
        if (imgurl != null) {
          final StringWriter writer = new StringWriter();
          DataURIGenerator.generate(imgurl, writer,
View Full Code Here


        && resource.getType() != Type.valueOf(typeOption.toString())) {
      return resource;
    }

    final ResourceGroup group = (ResourceGroup) resource;
    final Resource input = group.getResources().get(0);

    final VFile snapshot = vfs.stack();
    try {
      final VFile target = vfs.find(input.getPath());
      final Writer writer = VFSUtils.createWriter(target);
      try {
        writer.write(group.getMerger().merge(group.getResources()));
      } finally {
        IOUtils.closeQuietly(writer);
      }
      return input.getResolver().resolve(target.getPath());
    } catch (final IOException e) {
      vfs.rollback(snapshot);
      throw e;
    }
  }
View Full Code Here

        throw new SmallerException("Failed to setup node for typescript", e);
      }
    }
    final String outfile = this.node.run(vfs,
        resource != null ? resource.getPath() : null, options);
    Resource result = resource;
    if (resource != null) {
      if (outfile != null) {
        result = resource.getResolver().resolve(outfile);
      } else {
        result = resource.getResolver().resolve(
View Full Code Here

      MDC.put("processor", proc.getName());
      try {
        final Processor processor = this.processorFactory.getProcessor(proc
            .getName());
        LOGGER.info("Executing processor {}", proc.getName());
        final Resource result = processor.execute(
            vfs,
            input == null ? null : resolver.resolve(input),
            injectGlobalOptionsFallback(version, manifest, proc.getName(),
                proc.getOptions()));
        input = result == null ? null : result.getPath();
      } finally {
        MDC.clear();
      }
    }
    if (input != null) {
View Full Code Here

    if (resource instanceof ResourceGroup) {
      resources = ((ResourceGroup) resource).getResources();
    } else {
      resources = Arrays.asList(resource);
    }
    final Resource input = resources.get(0);

    if (runWithNode()) {
      return input.getResolver().resolve(
          '/' + this.node.run(vfs, input.getPath(), options));
    } else {
      return ProcessorUtil.process(vfs, input, "less", "css",
          new ProcessorCallback() {
            @Override
            public void call(final Reader reader, final Writer writer)
                throws IOException {
              LessjsProcessor.this.proxy.setResolver(input.getResolver());
              try {
                final StringWriter tempWriter = new StringWriter();
                LessjsProcessor.this.executor.run(
                    new StringReader(input.getContents()), tempWriter);
                writer.write(tempWriter.toString()
                    .replace(WIN_LOC_HREF_FIX, ""));
              } finally {
                LessjsProcessor.this.proxy.removeResolver();
              }
View Full Code Here

        throw new SmallerException("Failed to setup node for coffeescript", e);
      }
    }
    final String outfile = this.node.run(vfs,
        resource != null ? resource.getPath() : null, options);
    Resource result = resource;
    if (resource != null) {
      if (outfile != null) {
        result = resource.getResolver().resolve(outfile);
      } else if (FilenameUtils.isExtension(resource.getPath(), "coffee")) {
        result = resource.getResolver().resolve(
View Full Code Here

TOP

Related Classes of de.matrixweb.smaller.resource.Resource

Copyright © 2018 www.massapicom. 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.