Allow easier overriding of js compiler (#2318)

This commit is contained in:
Daniël Klabbers 2020-09-30 01:03:51 +02:00 committed by GitHub
parent 7629aad6ce
commit 656dec65dc

View File

@ -102,7 +102,7 @@ class Assets
public function makeJs(): JsCompiler public function makeJs(): JsCompiler
{ {
$compiler = new JsCompiler($this->assetsDir, $this->name.'.js'); $compiler = $this->makeJsCompiler($this->name.'.js');
$this->populate($compiler, 'js'); $this->populate($compiler, 'js');
@ -120,7 +120,7 @@ class Assets
public function makeLocaleJs(string $locale): JsCompiler public function makeLocaleJs(string $locale): JsCompiler
{ {
$compiler = new JsCompiler($this->assetsDir, $this->name.'-'.$locale.'.js'); $compiler = $this->makeJsCompiler($this->name.'-'.$locale.'.js');
$this->populate($compiler, 'localeJs', $locale); $this->populate($compiler, 'localeJs', $locale);
@ -136,6 +136,11 @@ class Assets
return $compiler; return $compiler;
} }
protected function makeJsCompiler(string $filename)
{
return new JsCompiler($this->assetsDir, $filename);
}
protected function makeLessCompiler(string $filename): LessCompiler protected function makeLessCompiler(string $filename): LessCompiler
{ {
$compiler = new LessCompiler($this->assetsDir, $filename); $compiler = new LessCompiler($this->assetsDir, $filename);