Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MinifyHtml to list of default transformers #330

Merged
merged 1 commit into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 12 additions & 23 deletions src/Optimizer/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
namespace AmpProject\Optimizer;

use AmpProject\Optimizer\Exception\UnknownConfigurationKey;
use AmpProject\Optimizer\Transformer\AmpBoilerplate;
use AmpProject\Optimizer\Transformer\AmpBoilerplateErrorHandler;
use AmpProject\Optimizer\Transformer\AmpRuntimeCss;
use AmpProject\Optimizer\Transformer\AmpRuntimePreloads;
use AmpProject\Optimizer\Transformer\GoogleFontsPreconnect;
use AmpProject\Optimizer\Transformer\OptimizeAmpBind;
use AmpProject\Optimizer\Transformer\OptimizeHeroImages;
use AmpProject\Optimizer\Transformer\PreloadHeroImage;
use AmpProject\Optimizer\Transformer\ReorderHead;
use AmpProject\Optimizer\Transformer\RewriteAmpUrls;
use AmpProject\Optimizer\Transformer\ServerSideRendering;
use AmpProject\Optimizer\Transformer\TransformedIdentifier;

/**
* Interface for a configuration object that validates and stores configuration settings.
Expand Down Expand Up @@ -46,17 +34,18 @@ interface Configuration
* @var string[]
*/
const DEFAULT_TRANSFORMERS = [
TransformedIdentifier::class,
AmpBoilerplate::class,
OptimizeHeroImages::class,
ServerSideRendering::class,
AmpRuntimeCss::class,
AmpRuntimePreloads::class,
AmpBoilerplateErrorHandler::class,
GoogleFontsPreconnect::class,
RewriteAmpUrls::class,
ReorderHead::class,
OptimizeAmpBind::class,
Transformer\TransformedIdentifier::class,
Transformer\AmpBoilerplate::class,
Transformer\OptimizeHeroImages::class,
Transformer\ServerSideRendering::class,
Transformer\AmpRuntimeCss::class,
Transformer\AmpRuntimePreloads::class,
Transformer\AmpBoilerplateErrorHandler::class,
Transformer\GoogleFontsPreconnect::class,
Transformer\RewriteAmpUrls::class,
Transformer\ReorderHead::class,
Transformer\OptimizeAmpBind::class,
Transformer\MinifyHtml::class,
Copy link
Collaborator Author

@schlessera schlessera Aug 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super obvious from the PR diff, but Transformer\MinifyHtml::class is an addition here, whereas the rest was just adapted to make use of relative namespaces.

];

/**
Expand Down
28 changes: 7 additions & 21 deletions src/Optimizer/DefaultConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,9 @@

namespace AmpProject\Optimizer;

use AmpProject\Optimizer\Configuration\AmpRuntimeCssConfiguration;
use AmpProject\Optimizer\Configuration\MinifyHtmlConfiguration;
use AmpProject\Optimizer\Configuration\OptimizeAmpBindConfiguration;
use AmpProject\Optimizer\Configuration\OptimizeHeroImagesConfiguration;
use AmpProject\Optimizer\Configuration\PreloadHeroImageConfiguration;
use AmpProject\Optimizer\Configuration\RewriteAmpUrlsConfiguration;
use AmpProject\Optimizer\Configuration\TransformedIdentifierConfiguration;
use AmpProject\Optimizer\Exception\InvalidConfigurationValue;
use AmpProject\Optimizer\Exception\UnknownConfigurationClass;
use AmpProject\Optimizer\Exception\UnknownConfigurationKey;
use AmpProject\Optimizer\Transformer\AmpRuntimeCss;
use AmpProject\Optimizer\Transformer\MinifyHtml;
use AmpProject\Optimizer\Transformer\OptimizeAmpBind;
use AmpProject\Optimizer\Transformer\OptimizeHeroImages;
use AmpProject\Optimizer\Transformer\PreloadHeroImage;
use AmpProject\Optimizer\Transformer\RewriteAmpUrls;
use AmpProject\Optimizer\Transformer\TransformedIdentifier;

/**
* Configuration object that validates and stores configuration settings.
Expand All @@ -45,13 +31,13 @@ class DefaultConfiguration implements Configuration
* @var array
*/
protected $transformerConfigurationClasses = [
AmpRuntimeCss::class => AmpRuntimeCssConfiguration::class,
OptimizeAmpBind::class => OptimizeAmpBindConfiguration::class,
OptimizeHeroImages::class => OptimizeHeroImagesConfiguration::class,
PreloadHeroImage::class => PreloadHeroImageConfiguration::class,
RewriteAmpUrls::class => RewriteAmpUrlsConfiguration::class,
TransformedIdentifier::class => TransformedIdentifierConfiguration::class,
MinifyHtml::class => MinifyHtmlConfiguration::class,
Transformer\AmpRuntimeCss::class => Configuration\AmpRuntimeCssConfiguration::class,
Transformer\OptimizeAmpBind::class => Configuration\OptimizeAmpBindConfiguration::class,
Transformer\OptimizeHeroImages::class => Configuration\OptimizeHeroImagesConfiguration::class,
Transformer\PreloadHeroImage::class => Configuration\PreloadHeroImageConfiguration::class,
Transformer\RewriteAmpUrls::class => Configuration\RewriteAmpUrlsConfiguration::class,
Transformer\TransformedIdentifier::class => Configuration\TransformedIdentifierConfiguration::class,
Transformer\MinifyHtml::class => Configuration\MinifyHtmlConfiguration::class,
];

/**
Expand Down