mirror of
https://github.com/flarum/framework.git
synced 2025-02-23 00:33:27 +08:00
Added support for new minifiers
This commit is contained in:
parent
98e3551ff2
commit
028d538008
@ -39,7 +39,7 @@
|
|||||||
"tobscure/json-api": "^0.2.0",
|
"tobscure/json-api": "^0.2.0",
|
||||||
"oyejorge/less.php": "~1.5",
|
"oyejorge/less.php": "~1.5",
|
||||||
"intervention/image": "^2.3.0",
|
"intervention/image": "^2.3.0",
|
||||||
"s9e/text-formatter": "^0.4.4",
|
"s9e/text-formatter": "^0.4.8",
|
||||||
"psr/http-message": "^1.0",
|
"psr/http-message": "^1.0",
|
||||||
"zendframework/zend-diactoros": "^1.1",
|
"zendframework/zend-diactoros": "^1.1",
|
||||||
"zendframework/zend-stratigility": "^1.1",
|
"zendframework/zend-stratigility": "^1.1",
|
||||||
|
@ -13,7 +13,8 @@ namespace Flarum\Asset;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Cache\Repository;
|
use Illuminate\Cache\Repository;
|
||||||
use MatthiasMullie\Minify;
|
use MatthiasMullie\Minify;
|
||||||
use s9e\TextFormatter\Configurator\JavaScript\Minifiers\ClosureCompilerService;
|
use s9e\TextFormatter\Configurator;
|
||||||
|
use s9e\TextFormatter\Configurator\JavaScript\Minifiers\FirstAvailable;
|
||||||
|
|
||||||
class JsCompiler extends RevisionCompiler
|
class JsCompiler extends RevisionCompiler
|
||||||
{
|
{
|
||||||
@ -82,14 +83,25 @@ class JsCompiler extends RevisionCompiler
|
|||||||
*/
|
*/
|
||||||
protected function minifyWithClosureCompilerService($source)
|
protected function minifyWithClosureCompilerService($source)
|
||||||
{
|
{
|
||||||
$minifier = new ClosureCompilerService;
|
// The minifier may need some classes bundled with the Configurator so we autoload it
|
||||||
|
class_exists(Configurator::class);
|
||||||
|
|
||||||
$minifier->compilationLevel = 'SIMPLE_OPTIMIZATIONS';
|
$minifier = new FirstAvailable;
|
||||||
$minifier->timeout = 60;
|
|
||||||
|
|
||||||
$output = $minifier->minify($source);
|
$remoteCache = $minifier->add('RemoteCache');
|
||||||
|
$remoteCache->url = 'http://s9e-textformatter.rhcloud.com/flarum-minifier/';
|
||||||
|
|
||||||
return $output;
|
$hostedMinifer = $minifier->add('HostedMinifier');
|
||||||
|
$hostedMinifer->url = 'http://s9e-textformatter.rhcloud.com/flarum-minifier/';
|
||||||
|
$hostedMinifer->timeout = 30;
|
||||||
|
|
||||||
|
$ccs = $minifier->add('ClosureCompilerService');
|
||||||
|
$ccs->compilationLevel = 'SIMPLE_OPTIMIZATIONS';
|
||||||
|
$ccs->timeout = 30;
|
||||||
|
|
||||||
|
$minifier->add('MatthiasMullieMinify');
|
||||||
|
|
||||||
|
return $minifier->minify($source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user