Fork me on GitHub

Supported locations matrix

Tables show when locations are supported, depending on:

Caching source code is disabled
Native compiler supports* Source factory supports Location is supported
yes yes yes
yes no no
no yes no
no no no
Caching source code is enabled
Native compiler supports* Source factory supports Location is supported
yes yes yes
yes no no
no yes yes
no no no

* Native compilers must support at least sources located at local drives

Custom locations

If the provided components (native compiler and/or source factory) do not support your location, you can create it on your own. You have to perform the following steps:

  1. implement biz.gabrys.lesscss.extended.compiler.source.LessSource which represents sources stored at the new location
  2. implement biz.gabrys.lesscss.extended.compiler.source.ConcreteSourceFactory responsible for creating new instances of sources and add it to the biz.gabrys.lesscss.extended.compiler.source.SourceFactory
  3. enable support of creation sources located at
    • the new location
    • local drives
    in the source factory
  4. use extended compiler which caching sources
  5. use native compiler which supports sources located at local drives
// creates source factory with custom and local concrete factories 
SourceFactory sourceFactory = new SourceFactoryBuilder().withCustom(new CustomConcreteSourceFactory()).withLocal().create();

// creates compiler with created source factory, default native compiler supports sources located at local drives
FullCache cache = new FullCacheBuilder().withDirectory(new File("/less-cache")).create();
ExtendedCompiler compiler = new CachingSourceCodeExtendedCompilerBuilder(cache).withSourceFactory(sourceFactory).create();

// creates and compile source file
LessSource source = new CustomSource(new File("/less/file.less"), "UTF-8");
String cssCode = compiler.compile(source);