Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

compile function returns base filename, not relative #15

Description

@dwilbanks

When using an optional $options['cache_dir'] parameter the CSS file that gets created will be created in that directory instead of the CSS directory.

However the \Less_Cache::Get function returns the basename() of the generated file.

The result of this problem is that the filename that gets passed to $this->Html->css a basename() and the filename that gets generated by \Less_Cache::Get is inside the ['cache_dir'] directory.

There are 3 scenarios.

  1. No $options['parser']['cache_dir']
  2. $options['parser']['cache_dir'] that begins with / relative to WWW_ROOT
  3. $options['parser']['cache_dir'] that does not begin with / relative to /css

The $this->compile() function looks like this:

if ($cache) {
   if( !isset($options['cache_dir'])){
      $options['cache_dir'] =$this->cssPath;
   } else if( substr( $options['cache_dir'], 0, 1 ) =='/'){
      $options['cache_dir']  = WWW_ROOT . $options['cache_dir'];
   } else {
      $options['cache_dir']  = trim($this->cssPath, '/') . $options['cache_dir'];
   }
   return \Less_Cache::Get($parse, $options, $modifyVars);
}

Inside the $this->less() function looks like this:

   $cache_dir = isset($options['parser']['cache_dir']) ? $options['parser']['cache_dir'] : "";
   $css = $cache_dir . $this->compile($less, $options['cache'], $options['parser'], $modifyVars);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions