Package com.github.sommeri.less4j.LessCompiler

Examples of com.github.sommeri.less4j.LessCompiler.CompilationResult


  }

  protected CompilationResult compile(File lessFile, File cssOutput) throws Less4jException {
    LessCompiler compiler = getCompiler();
    Configuration configuration = createConfiguration(cssOutput);
    CompilationResult actual = compiler.compile(lessFile, configuration);
    return actual;
  }
View Full Code Here


    List<Problem> result = Collections.emptyList();
    return result;
  }

  protected void validateSourceMap(String mapdataFile, String cssFile, String mapFile) {
    CompilationResult result = new CompilationResult(fileUtils.readFile(cssFile), fileUtils.readFile(mapFile), noProblems());
    sourceMapValidator.validateSourceMap(result, new File(mapdataFile), new File(cssFile));
  }
View Full Code Here

  }
 
  @Test
  public void string() throws Less4jException {
    LessCompiler compiler = new DefaultLessCompiler();
    CompilationResult compilationResult = compiler.compile(NO_IMPORT_LESS_INPUT);
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertDoesNotLinkSourceMap(compilationResult.getCss());
   
    SourceMapValidator validator = new SourceMapValidator(LESS_INPUT_CONTENTS);
    validator.validateSourceMap(compilationResult, new File(NO_DATA_AVAILABLE_MAPDATA));
  }
View Full Code Here

  }

  @Test
  public void stringWithEmptyConfiguration() throws Less4jException {
    LessCompiler compiler = new DefaultLessCompiler();
    CompilationResult compilationResult = compiler.compile(NO_IMPORT_LESS_INPUT, new Configuration());
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertDoesNotLinkSourceMap(compilationResult.getCss());
   
    SourceMapValidator validator = new SourceMapValidator(LESS_INPUT_CONTENTS);
    validator.validateSourceMap(compilationResult, new File(NO_DATA_AVAILABLE_MAPDATA));
  }
View Full Code Here

  @Test
  public void stringWithSourceMap() throws Less4jException {
    LessCompiler compiler = new DefaultLessCompiler();
    Configuration options = new Configuration();
    options.getSourceMapConfiguration().setInline(true);
    CompilationResult compilationResult = compiler.compile(NO_IMPORT_LESS_INPUT, options);
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertInlineSourceMap(compilationResult);
   
    SourceMapValidator validator = new SourceMapValidator(LESS_INPUT_CONTENTS);
    validator.validateSourceMap(compilationResult, new File(NO_DATA_AVAILABLE_MAPDATA));
  }
View Full Code Here

  public void stringWithConfiguration() throws Less4jException {
    Configuration configuration = new Configuration();
    configuration.setCssResultLocation(FAKE_CSS_RESULT_FILE);
   
    LessCompiler compiler = new DefaultLessCompiler();
    CompilationResult compilationResult = compiler.compile(NO_IMPORT_LESS_INPUT, configuration);
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertLinksSourceMap(compilationResult.getCss(), FAKE_CSS_RESULT_LINKED_MAP);

    SourceMapValidator validator = new SourceMapValidator(LESS_INPUT_CONTENTS);
    validator.validateSourceMap(compilationResult, new File(FAKE_CSS_DATA_AVAILABLE_MAPDATA));
  }
View Full Code Here

  public void stringWithURLConfiguration() throws Less4jException {
    Configuration configuration = new Configuration();
    configuration.setCssResultLocation(new LessSource.URLSource(FAKE_URL_RESULT_URL));
   
    LessCompiler compiler = new DefaultLessCompiler();
    CompilationResult compilationResult = compiler.compile(NO_IMPORT_LESS_INPUT, configuration);
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertLinksSourceMap(compilationResult.getCss(), FAKE_URL_RESULT_LINKED_MAP);

    SourceMapValidator validator = new SourceMapValidator(LESS_INPUT_CONTENTS);
    validator.validateSourceMap(compilationResult, new File(FAKE_URL_DATA_AVAILABLE_MAPDATA));
  }
View Full Code Here

  }
  @Test
  public void file() throws Less4jException {
    LessCompiler compiler = new DefaultLessCompiler();
    CompilationResult compilationResult = compiler.compile(ONE_IMPORT_LESS_FILE);
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertLinksSourceMap(compilationResult.getCss(), toFullMapSuffix());
   
    SourceMapValidator validator = new SourceMapValidator(LESS_INPUT_CONTENTS);
    validator.validateSourceMap(compilationResult, new File(ONE_IMPORT_MAPDATA_GUESSED_CSS), URIUtils.changeSuffix(ONE_IMPORT_LESS_FILE, Constants.FULL_SOURCE_MAP_SUFFIX));
  }
View Full Code Here

  }

  @Test
  public void fileWithEmptyConfiguration() throws Less4jException {
    LessCompiler compiler = new DefaultLessCompiler();
    CompilationResult compilationResult = compiler.compile(ONE_IMPORT_LESS_FILE, new Configuration());
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertLinksSourceMap(compilationResult.getCss(), toFullMapSuffix());
   
    SourceMapValidator validator = new SourceMapValidator(LESS_INPUT_CONTENTS);
    validator.validateSourceMap(compilationResult, new File(ONE_IMPORT_MAPDATA_GUESSED_CSS), URIUtils.changeSuffix(ONE_IMPORT_LESS_FILE, Constants.CSS_SUFFIX));
  }
View Full Code Here

  @Test
  public void fileDoNotRelativize() throws Less4jException {
    LessCompiler compiler = new DefaultLessCompiler();
    Configuration configuration = new Configuration();
    configuration.getSourceMapConfiguration().setRelativizePaths(false);
    CompilationResult compilationResult = compiler.compile(ONE_IMPORT_LESS_FILE, configuration);
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertLinksSourceMap(compilationResult.getCss(), toFullMapSuffix());
   
    SourceMapValidator validator = new SourceMapValidator("");
    validator.validateSourceMap(compilationResult, new File(ONE_IMPORT_MAPDATA_NO_RELATIVIZATION), URIUtils.changeSuffix(ONE_IMPORT_LESS_FILE, Constants.CSS_SUFFIX));
  }
View Full Code Here

TOP

Related Classes of com.github.sommeri.less4j.LessCompiler.CompilationResult

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.