Package com.github.sommeri.less4j.LessCompiler

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


  }

  @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);
View Full Code Here


    validator.validateSourceMap(compilationResult, new File(NO_DATA_AVAILABLE_MAPDATA));
  }

  @Test
  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());
View Full Code Here

    validator.validateSourceMap(compilationResult, new File(FAKE_CSS_DATA_AVAILABLE_MAPDATA));
  }
  @Test
  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());
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());
   
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());
View Full Code Here

  }

  @Test
  public void fileIncludeLessFiles() throws Less4jException {
    LessCompiler compiler = new DefaultLessCompiler();
    Configuration configuration = new Configuration();
    configuration.getSourceMapConfiguration().setIncludeSourcesContent(true);
    CompilationResult compilationResult = compiler.compile(ONE_IMPORT_LESS_FILE, configuration);
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertLinksSourceMap(compilationResult.getCss(), toFullMapSuffix());
View Full Code Here

  }

  @Test
  public void fileSelfContained() throws Less4jException {
    LessCompiler compiler = new DefaultLessCompiler();
    Configuration configuration = new Configuration();
    configuration.getSourceMapConfiguration().setIncludeSourcesContent(true);
    configuration.getSourceMapConfiguration().setInline(true);
    CompilationResult compilationResult = compiler.compile(ONE_IMPORT_LESS_FILE, configuration);
   
    assertNotNull(compilationResult.getCss());
    assertNotNull(compilationResult.getSourceMap());
    assertInlineSourceMap(compilationResult);
View Full Code Here

    validator.validateSourceMap(compilationResult, new File(ONE_IMPORT_MAPDATA_WITH_LESS), URIUtils.changeSuffix(ONE_IMPORT_LESS_FILE, Constants.CSS_SUFFIX));
  }

  @Test
  public void fileWithConfiguration() throws Less4jException {
    Configuration configuration = new Configuration();
    configuration.setCssResultLocation(new File(FAKE_CSS_RESULT_LOCATION));

    LessCompiler compiler = new DefaultLessCompiler();
    CompilationResult compilationResult = compiler.compile(ONE_IMPORT_LESS_FILE, configuration);
   
    assertNotNull(compilationResult.getCss());
View Full Code Here

    validator.validateSourceMap(compilationResult, new File(ONE_IMPORT_CSS_KNOWN_MAPDATA), FAKE_CSS_RESULT_FILE);
  }
 
  @Test
  public void fileWithUrlConfiguration() throws Less4jException {
    Configuration configuration = new Configuration();
    configuration.setCssResultLocation(new LessSource.URLSource(FAKE_URL_RESULT_URL));

    LessCompiler compiler = new DefaultLessCompiler();
    CompilationResult compilationResult = compiler.compile(ONE_IMPORT_LESS_FILE, configuration);
   
    assertNotNull(compilationResult.getCss());
View Full Code Here

  @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

TOP

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

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.