mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Use Formatter class to add multiple common scripts at the same time
This commit is contained in:
parent
753a70005a
commit
2a8c18eb01
3 changed files with 34 additions and 22 deletions
|
|
@ -251,7 +251,18 @@ class Formatter
|
|||
*/
|
||||
public static function minifyCSS($source_filename, $target_filename)
|
||||
{
|
||||
$minifier = new \MatthiasMullie\Minify\CSS($source_filename);
|
||||
$minifier = new \MatthiasMullie\Minify\CSS();
|
||||
if (is_array($source_filename))
|
||||
{
|
||||
foreach ($source_filename as $filename)
|
||||
{
|
||||
$minifier->add($filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$minifier->add($source_filename);
|
||||
}
|
||||
$content = $minifier->execute($target_filename);
|
||||
Storage::write($target_filename, $content);
|
||||
return strlen($content) ? true : false;
|
||||
|
|
@ -266,7 +277,18 @@ class Formatter
|
|||
*/
|
||||
public static function minifyJS($source_filename, $target_filename)
|
||||
{
|
||||
$minifier = new \MatthiasMullie\Minify\JS($source_filename);
|
||||
$minifier = new \MatthiasMullie\Minify\JS();
|
||||
if (is_array($source_filename))
|
||||
{
|
||||
foreach ($source_filename as $filename)
|
||||
{
|
||||
$minifier->add($filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$minifier->add($source_filename);
|
||||
}
|
||||
$content = $minifier->execute($target_filename);
|
||||
Storage::write($target_filename, $content);
|
||||
return strlen($content) ? true : false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue