HtmlCompress icon indicating copy to clipboard operation
HtmlCompress copied to clipboard

Feature request: extend API to allow setting options on HtmlMin + to add patterns

Open abuyoyo opened this issue 4 years ago • 0 comments

Introduce compressor() method to HtmlCompressor interface. This will allow direct access to HtmlMin API.

$parser = \WyriHaximus\HtmlCompress\Factory::construct();
$htmlMinInstance = $parser->compressor();
$htmlMinInstance->doRemoveHttpPrefixFromAttributes();
$htmlMinInstance->doMakeSameDomainsLinksRelative(['example.com']);
$compressedHtml = $parser->compress($sourceHtml);

Introduce patterns() method to HtmlCompressor interface. Introduce add(PatternInterface $pattern) method to Patterns class. This will allow usage such as this:

$parser = \WyriHaximus\HtmlCompress\Factory::construct();
$patterns = $parser->patterns();
$patterns->add(CustomPatternThatImplementsPatternInterface);
$compressedHtml = $parser->compress($sourceHtml);

abuyoyo avatar Mar 13 '20 04:03 abuyoyo