refactors + support for onAdminCompilePresetSCSS() event

This commit is contained in:
Andy Miller
2020-04-20 13:08:23 -06:00
parent 6bfbaf5ce4
commit c295cb0322
5 changed files with 71 additions and 53 deletions

View File

@@ -21,19 +21,19 @@ class ScssCompiler
return $this;
}
public function setVariables($variables)
public function setVariables(array $variables)
{
$this->compiler()->setVariables($variables);
return $this;
}
public function setImportPaths($paths)
public function setImportPaths(array $paths)
{
$this->compiler()->setImportPaths($paths);
return $this;
}
public function compile($input_file, $output_file)
public function compile(string $input_file, string $output_file)
{
$input = file_get_contents($input_file);
$output = $this->compiler()->compile($input);
@@ -41,4 +41,15 @@ class ScssCompiler
return $this;
}
public function compileAll(array $input_paths, string $output_file)
{
$input = '';
foreach ($input_paths as $input_file) {
$input .= trim(file_get_contents($input_file)) . "\n\n";
}
$output = $this->compiler()->compile($input);
file_put_contents($output_file, $output);
return $this;
}
}