composer require lochmueller/sourceopt
via TypoScript
[constants]
@import 'EXT:sourceopt/Configuration/TypoScript/constants'
[setup]
@import 'EXT:sourceopt/Configuration/TypoScript/setup'
[EXT:sourceopt/Configuration/TypoScript]
into Include static
at Includes
in Template
Include the extension and go to the Constant Editor
of a template where you find all options under PLUGIN
The PHP process need server performance, because there are several search/replace operations in the logic
Note: The following features are executed in reverse order
TypoScript [constants] |
prepend config. at [setup] |
Property | Type | Description | Default | |
---|---|---|---|---|---|---|
sourceopt.enabled | boolean | Is the optimization enabled for this template | 1 | |||
sourceopt.removeGenerator | boolean | Remove \<meta name="generator" content="TYPO3 CMS"> | 1 | |||
sourceopt.removeComments | boolean | Remove HTML-Comments | 1 | |||
sourceopt.removeComments.keep | array | Spare these listed comments: Regular expressions that match comments that should not be removed. Very useful e.g. to keep the TYPO3SEARCH-Comments so indexed_search can work properly | .10 |
|||
sourceopt.removeComments.keep.10 | string | Spare TYPO3SEARCH-Comments from removal | /^TYPO3SEARCH_/usi | |||
sourceopt.headerComment | string | Your additional (appended) header comment | [empty] |
|||
sourceopt.formatHtml | integer | Formats the code beautiful and easy readable. New lines and tabs are used in the usual way of illustrating the structure of an XML code. | 4 | |||
sourceopt.formatHtml.tabSize | integer | Defines the size of the tabs used for formating. If blank one tab is used. If a number is specified the specified number of blank spaces is used instead. This will only work together with formatHtml |
[empty] |
|||
sourceopt.formatHtml.debugComment | boolean | Includes a comment at the end of the html source code that points the numbers of open html tags. This will only work together with formatHtml |
[empty] |
TypoScript [setup]
incl. stdWrap
config.replacer {
search {
1 = /(?<="|')\/?(fileadmin|typo3temp|uploads)/
give-me-cherries = /fruit/
wrapBoldly < tmp.find
wrapBoldly.wrap = /|/
}
replace {
1 = //cdn.tld/$1
give-me-cherries = cherry
wrapBoldly < tmp.repl
wrapBoldly.wrap = <b>|</b>
}
}
Note: both arrays will be ksort'ed in "natural order"
TypoScript [constants] |
prepend config. at [setup] |
Property | Type | Description | Default | |
---|---|---|---|---|---|---|
svgstore.enabled | boolean | Is the SVG extract & merge enabled for this template | 1 | |||
svgstore.fileSize | integer | Maximum file size of a SVG to include (in [byte] ) |
50000 |