Examples of LessCompiler


Examples of com.github.sommeri.less4j.LessCompiler

  @Override
  protected CompilationResult compile(File lessFile, File cssOutput) throws Less4jException {
    try {
      String less = IOUtils.toString(new FileReader(lessFile));
      LessCompiler compiler = getCompiler();
      Configuration configuration = createConfiguration(cssOutput);
      CompilationResult actual = compiler.compile(new StringSource(less), configuration);
      return actual;
    } catch (IOException ex) {
      throw new RuntimeException("Can not read less file " + lessFile.getName(), ex);
    }
  }
View Full Code Here

Examples of org.lesscss.LessCompiler

          throw new LessCssException(
              "Custom LESS JavaScript is not currently supported when using nodeExecutable");
        }
        lessCompiler = nodeJsLessCssCompiler;
      } else {
        LessCompiler newLessCompiler = new LessCompiler();
        newLessCompiler.setCompress(compress);
        newLessCompiler.setEncoding(encoding);
        if (lessJs != null) {
          try {
            newLessCompiler.setLessJs(lessJs.toURI().toURL());
          } catch (MalformedURLException e) {
            throw new LessCssException(
                "Error while loading LESS JavaScript: " + lessJs.getAbsolutePath(), e);
          }
        }
View Full Code Here

Examples of org.lesscss.LessCompiler

  public boolean stop() {
    return false;
  }

  public static void main(String[] args) throws LessException, IOException {
    LessCompiler lessCompiler = new LessCompiler(Arrays.asList("--relative-urls", "--strict-math=on"));
    String css = lessCompiler.compile("@color: #4D926F; #header { color: @color; }");
//        System.out.println(css);


    lessCompiler = new LessCompiler(Arrays.asList("--relative-urls", "--strict-math=on"));
    css = lessCompiler.compile(new File(PathKit.getWebRootPath() + "/src/main/webapp/css/app/_layout.less"));
    System.out.println(css);

    LessCssCompiler lessCssCompiler = new LessCssCompiler();
    lessCssCompiler.setBuildContext(ThreadBuildContext.getContext());
    lessCssCompiler.setSourceDirectory(new File(PathKit.getWebRootPath() + "/css/"));
View Full Code Here

Examples of org.lesscss.LessCompiler

          throw new LessCssException(
              "Custom LESS JavaScript is not currently supported when using nodeExecutable");
        }
        lessCompiler = nodeJsLessCssCompiler;
      } else {
        LessCompiler newLessCompiler = new LessCompiler();
        newLessCompiler.setCompress(compress);
        newLessCompiler.setEncoding(encoding);
        if (lessJs != null) {
          try {
            newLessCompiler.setLessJs(lessJs.toURI().toURL());
          } catch (MalformedURLException e) {
            throw new LessCssException(
                "Error while loading LESS JavaScript: " + lessJs.getAbsolutePath(), e);
          }
        }
View Full Code Here

Examples of org.lesscss.LessCompiler

  public boolean stop() {
    return false;
  }

  public static void main(String[] args) throws LessException, IOException {
    LessCompiler lessCompiler = new LessCompiler(Arrays.asList("--relative-urls", "--strict-math=on"));
    String css = lessCompiler.compile("@color: #4D926F; #header { color: @color; }");
//        System.out.println(css);


    lessCompiler = new LessCompiler(Arrays.asList("--relative-urls", "--strict-math=on"));
    css = lessCompiler.compile(new File(PathKit.getWebRootPath() + "/src/main/webapp/css/app/_layout.less"));
    System.out.println(css);

    LessCssCompiler lessCssCompiler = new LessCssCompiler();
    lessCssCompiler.setBuildContext(ThreadBuildContext.getContext());
    lessCssCompiler.setSourceDirectory(new File(PathKit.getWebRootPath() + "/css/"));
View Full Code Here

Examples of org.lesscss.LessCompiler

    this.logger = logger;
    this.oracle = oracle;
  }

  public File convert(URL resource) throws IOException {
    LessCompiler lessCompiler = new LessCompiler();
    try {
      String lessFile = readLessFile(resource);
      final String css = lessCompiler.compile(lessFile);
      return createCssFile(css);
    } catch (LessException e) {
      throw new IOException("specified less stylesheet could not be compiled to css", e);
    }
  }
View Full Code Here

Examples of org.lesscss.LessCompiler

        throw new MojoExecutionException(
            "Custom LESS JavaScript is not currently supported when using nodeExecutable");
      }
      return lessCompiler;
    } else {
      LessCompiler lessCompiler = new LessCompiler();
      lessCompiler.setCompress(compress);
      lessCompiler.setEncoding(encoding);
      if (lessJs != null) {
        try {
          lessCompiler.setLessJs(lessJs.toURI().toURL());
        } catch (MalformedURLException e) {
          throw new MojoExecutionException(
              "Error while loading LESS JavaScript: " + lessJs.getAbsolutePath(), e);
        }
      }
View Full Code Here

Examples of org.lesscss.LessCompiler

* @author edewit@redhat.com
*/
public class LessConverter {

  public File convert(URL resource) throws IOException {
    LessCompiler lessCompiler = new LessCompiler();
    try {
      String lessFile = readLessFile(resource);
      final String css = lessCompiler.compile(lessFile);
      return createCssFile(css);
    } catch (LessException e) {
      throw new IOException("specified less stylesheet could not be compiled to css", e);
    }
  }
View Full Code Here

Examples of org.lesscss.LessCompiler

* @author edewit@redhat.com
*/
public class LessConverter {

  public File convert(URL resource) throws IOException {
    LessCompiler lessCompiler = new LessCompiler();
    try {
      final File compiled = File.createTempFile("compiled", ".css");
      lessCompiler.compile(new File(resource.toURI()), compiled);
      return compiled;
    } catch (LessException e) {
      throw new IOException("specified less stylesheet could not be compiled to css", e);
    } catch (URISyntaxException e) {
      throw new IOException("could not convert resource to file", e);
View Full Code Here

Examples of org.lesscss.LessCompiler

    this.logger = logger;
    this.oracle = oracle;
  }

  public File convert(URL resource) throws IOException {
    LessCompiler lessCompiler = new LessCompiler();
    try {
      String lessFile = parseLess(resource);
      final String css = lessCompiler.compile(lessFile);
      return createCssFile(css);
    } catch (LessException e) {
      throw new IOException("specified less stylesheet could not be compiled to css", 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.