Typoscript: Performance erhöhen.
TYPO3 Setup
config {
#schreibt das Standard-JS zum Verschleiern der E-Mailadresse in eine temporäre Datei
removeDefaultJS = external
inlineStyle2TempFile = 1
#Unterbinden von HTML-Kommentare
disablePrefixComment = 1
#Javascript komprimieren
compressJs = 1
#Javascript zu einer Datei zusammenführen
concatenateJs = 1
# CSS komprimieren
compressCss = 1
#CSS zu einer Datei zusammenführen
concatenateCss = 1
#Löscht HTML-Kommentare <!-- -->
disablePrefixComment = 1
}
Es werden nur JS- und CSS-Dateien einbezogen, die über includeCSS, includeCSSLibs, includeJS, includeJSFooter, includeJSLibs und includeJSFooterlibs eingebunden wurden.
Einige Scripte mögen nicht komprimiert oder zusammengefasst werden (z.B. Fancybox). In dem Fall kann man die Skripte aus der Kompression oder der Zusammenfassung (concatenation) herausnehmen:
page {
includeJSFooter.fancybox.excludeFromConcatenation = 1
includeJSFooter.fancybox.disableCompression = 1
includeCSS.fancybox.disableCompression = 1
includeCSS.fancybox.excludeFromConcatenation = 1
}
Link zum Testen der Performance:
SISTRIX
Seobility
.htaccess Datei anpassen
Um die Komprimierung der Skripte zu gewährleisten, muss die .htacess-Datei angepasst werden:
<FilesMatch "\.js\.gzip$">
AddType "text/javascript" .gzip
</FilesMatch>
<FilesMatch "\.css\.gzip$">
AddType "text/css" .gzip
</FilesMatch>
AddEncoding gzip .gzip
Um eingebundene Ressourcen serverseitig zu komprimieren, kann man gleich noch folgendes hinterherschieben:
<IfModule mod_deflate.c>
# Force compression for mangled `Accept-Encoding` request headers
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/ld+json \
application/manifest+json \
application/rdf+xml \
application/rss+xml \
application/schema+json \
application/vnd.geo+json \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/x-javascript \
application/x-web-app-manifest+json \
application/xhtml+xml \
application/xml \
font/eot \
font/opentype \
image/bmp \
image/svg+xml \
image/vnd.microsoft.icon \
image/x-icon \
text/cache-manifest \
text/css \
text/html \
text/javascript \
text/plain \
text/vcard \
text/vnd.rim.location.xloc \
text/vtt \
text/x-component \
text/x-cross-domain-policy \
text/xml
</IfModule>
<IfModule mod_mime.c>
AddEncoding gzip svgz
</IfModule>
</IfModule>