Skip to content

Commit 1ae25e6

Browse files
committed
Add ignore option
1 parent 7dba8a6 commit 1ae25e6

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,17 @@ https://github.com/voku/HtmlMin#options
6767

6868
````php
6969
return [
70-
'afbora.kirby-minify-html.enabled' => true,
71-
'afbora.kirby-minify-html.options' => [
72-
'doOptimizeViaHtmlDomParser' => true,
73-
'doRemoveSpacesBetweenTags' => false,
74-
'doMakeSameDomainsLinksRelative' => ['example.com']
75-
],
70+
'afbora.kirby-minify-html' => [
71+
'enabled' => true,
72+
'ignore' => [
73+
'sitemap',
74+
'rss'
75+
],
76+
'options' => [
77+
'doOptimizeViaHtmlDomParser' => true,
78+
'doRemoveSpacesBetweenTags' => false,
79+
'doMakeSameDomainsLinksRelative' => ['example.com']
80+
]
81+
]
7682
];
7783
````

composer.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
{
22
"name": "afbora/kirby-minify-html",
3-
"description": "Enable minify HTML output for Kirby 3 and 4.",
4-
"version": "2.1.0",
3+
"description": "Enable minify HTML output for Kirby",
4+
"version": "2.2.0",
55
"keywords": [
6-
"kirby",
7-
"kirby-3",
8-
"kirby-4",
9-
"kirby-cms",
10-
"kirby3-plugin",
11-
"kirby4-plugin",
12-
"kirby-plugin"
6+
"kirby3",
7+
"kirby4",
8+
"kirby5"
139
],
1410
"type": "kirby-plugin",
1511
"license": "MIT",

index.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22

33
@include_once __DIR__ . '/vendor/autoload.php';
44

5-
use Kirby\Cms\App as Kirby;
6-
use Kirby\Cms\Template;
5+
use Kirby\Cms\App;
6+
use Kirby\Template\Template;
77
use voku\helper\HtmlMin;
88

99
class MinifyHTML extends Template
1010
{
11-
/**
12-
* @param array $data
13-
* @return string
14-
*/
1511
public function render(array $data = []): string
1612
{
17-
$kirby = Kirby::instance();
18-
$html = parent::render($data);
13+
$kirby = App::instance();
14+
$html = parent::render($data);
1915

2016
if (
2117
$kirby->option('afbora.kirby-minify-html.enabled') === true &&
18+
in_array($this->name(), $kirby->option('afbora.kirby-minify-html.ignore', [])) === false &&
2219
$this->hasDefaultType() === true
2320
) {
2421
$htmlMin = new HtmlMin();
@@ -42,12 +39,13 @@ public function render(array $data = []): string
4239
}
4340

4441
Kirby::plugin('afbora/kirby-minify-html', [
45-
'options' => [
42+
'options' => [
4643
'enabled' => true,
44+
'ignore' => [],
4745
'options' => []
4846
],
4947
'components' => [
50-
'template' => function (Kirby $kirby, string $name, string $type = 'html', string $defaultType = 'html') {
48+
'template' => function (App $kirby, string $name, string $type = 'html', string $defaultType = 'html') {
5149
return new MinifyHTML($name, $type, $defaultType);
5250
}
5351
]

0 commit comments

Comments
 (0)