A
A
Andrey2020-07-07 11:39:52
PHP
Andrey, 2020-07-07 11:39:52

Compiler wikimedia / less.php how do you arrange directories, sources, cache and resulting file?

Question for those who use lessphp.

I want to set up the library as follows:
- to list the sources less my bike and not about it
- I put the cache files in the data directory (above the www root)
- put the resulting file with a unique name in a directory accessible via www

I want to share, so that in public there was no garbage - cache files, so that these files do not interfere in the IDE.

But I ran into a problem: the output parameter does not make it possible to change only the file path and leave the copied name.

Judging by the code, I can specify either just the name of the output file in the cache directory, or the full file name.

private static function OutputFile( $compiled_name, $parser_options ){

    //custom output file
    if( !empty($parser_options['output']) ){

      //relative to cache directory?
      if( preg_match('#[\\\\/]#',$parser_options['output']) ){
        return $parser_options['output'];
      }

      return Less_Cache::$cache_dir.$parser_options['output'];
    }

    return Less_Cache::$cache_dir.$compiled_name;
  }


Since a lot of people use this library, then there are worthy use cases. Please share :)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question