- The most fundamental blocker. Drupal <8 used to be developer-friendly by default rather than fast by default, which meant that if we'd ship with JS aggregation/minification enabled by default, we'd have to detect file system changes on every request, which would be detrimental for performance. changes that: aggregation can be enabled by default, and when developing, it's easy to disable aggregation.
- The secondary blocker. Far too often, we don't know and cannot determine the license of an asset! addresses that.
- The tertiary blocker. The license problem: proper minification deletes all non-essential data, including license information. That's the part this issue addresses.
- The last mile. We couldn't find consensus on which JS minification tool to use. This issue doesn't aim to solve that, it only aims to make it possible to add JS minification at a later point in time to Drupal 8, since adding that is not an API change, it's improving an existing feature. (Our current "minification" strategy is: "just use the entire file, and append a defensive semi-colon".) That could even happen after beta 1 (see #3).
In essence, JSLWL requires us to list every JS file on the site, with its license and full source.
So, the proposed solution takes these steps:
- associates the license information with each asset library.
So either: an unminified aggregate, or an archive containing all aggregated JS files and a describing file. The latter is much more painful to do, so we choose the first, for which we already have the necessary infrastructure. The JS asset collection optimizer (
asset.js.collection_optimizer) tracks its aggregated (and minified) JS files (we can get them via
AssetCollectionOptimizerInterface::getAll()); by adding a secondary JS asset collection optimizer
User interface changes
- (Not really an API change, but an internal behavior change.) An unminified aggregate is generated for every minified aggregate.
- Route/response addition:
- (Not really an API change, but a markup addition.) Each page has a
<link rel="jslicense" href="/system/jslicense" />tag in the HTML head.
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 92,161 pass(es), 808 fail(s), and 119 exception(s). View
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 81,641 pass(es), 465 fail(s), and 34 exception(s). View