1
0
mirror of https://github.com/flarum/core.git synced 2025-07-26 11:10:41 +02:00

Bundle unminified JS; minify via ClosureCompilerService when in production

Falls back to a less effective minification library if ClosureCompilerService errors or is unavailable. Minification takes a while (20 seconds or so), but it only happens when assets are modified. Still, this means enabling/disabling extensions is taking far too long. Possible solutions:

- Don't minify initially; set a process running in the background to do minification, and server unminified assets in the meantime.
- Refactor compiler to send each JS file to CCS individually, only if that particular file has been modified.

flarum/gulp has also been updated to no longer support uglification.

closes #582
This commit is contained in:
Toby Zerner
2015-10-09 00:33:53 +10:30
parent 223b6a4065
commit 2032dc20bb
9 changed files with 55904 additions and 73 deletions

View File

@@ -187,7 +187,7 @@ abstract class AbstractClientController extends AbstractHtmlController
$public = $this->getAssetDirectory();
$assets = new AssetManager(
new JsCompiler($public, "$this->clientName.js"),
new JsCompiler($public, "$this->clientName.js", ! $this->app->config('debug')),
new LessCompiler($public, "$this->clientName.css", $this->app->storagePath().'/less')
);