Skip to content

Commit

Permalink
#55 add documentation [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
tbela99 committed Sep 7, 2019
1 parent 9e0656f commit 4978106
Show file tree
Hide file tree
Showing 8 changed files with 281 additions and 15 deletions.
260 changes: 260 additions & 0 deletions Docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
---
path: "/help/index"
title: "Joomla GZIP Plugin Documentation"
---

# Joomla GZIP Plugin Documentation

_V2.6.0_

- [Joomla GZIP Plugin Documentation](#joomla-gzip-plugin-documentation)
- [Installing](#installing)
- [Manage Settings](#manage-settings)
- [General Settings](#general-settings)
- [Debug](#debug)
- [Minify HTML](#minify-html)
- [HTTP Settings](#http-settings)
- [Enable Save-Data support](#enable-save-data-support)
- [HTTP Server Timing](#http-server-timing)
- [DNS Prefetch](#dns-prefetch)
- [HTTP Push](#http-push)
- [Cache File](#cache-file)
- [Hashing Method](#hashing-method)
- [Cache Prefix](#cache-prefix)
- [Max Age](#max-age)
- [CORS Headers](#cors-headers)
- [Custom Mimetypes](#custom-mimetypes)
- [Custom Attributes](#custom-attributes)
- [CDN](#cdn)
- [Enable CDN](#enable-cdn)
- [Access Control Allow Origin](#access-control-allow-origin)
- [Redirect CDN Request](#redirect-cdn-request)
- [CDN1, CDN2, CDN3](#cdn1-cdn2-cdn3)
- [Enable static domain for custom resources type](#enable-static-domain-for-custom-resources-type)
- [Use Static Domain](#use-static-domain)
- [Images](#images)
- [Process Images](#process-images)
- [Enforce Width and Height Attributes](#enforce-width-and-height-attributes)
- [Fetch Remote Images](#fetch-remote-images)
- [Convert Images to Webp](#convert-images-to-webp)
- [Ignored Images](#ignored-images)
- [Crop Method](#crop-method)
- [Image Placeholder](#image-placeholder)
- [Responsive Images](#responsive-images)
- [Responsive Image Breakpoints](#responsive-image-breakpoints)
- [Responsive CSS background Images](#responsive-css-background-images)
- [Responsive CSS Image Breakpoints](#responsive-css-image-breakpoints)

This document explains how to configure the Joomla GZip plugin.

What is the plugin doing?

This extension provides:

- when the client sends [Save-Data header](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/save-data/), optimizations are enforced.
- html, images, javascript and css optimizations (and more) that greatly improve page loading time
- service worker features like transforming your website into a progressive web application, configure an offline page, offline first application, push notifications, background sync, web share target level 2, network strategy and more ...
- improve security by providing configurable HTTP secure headers
- improve security by implementing Content Security Policy level 3 headers
- improve security by adding Sub Resource Integrity tokens to javascript and css files
- profile the plugin performance (or your server performance) by using the HTTP server timing headers

there are loads of settings provided to help you fine tune your website.

## Installing

this plugin has been developed for Joomla version 3 and 4. It requires rewrite rules to be enabled in order to work properly

## Manage Settings

### General Settings

Configure general settings

![General settings](../images/general-settings.PNG)
#### Debug

If yes, load plugin's unminified css and javascript files, otherwise load minfied versions.

#### Minify HTML

Enable or disable HTML minification.

### HTTP Settings

![HTTP settings](../images/http-settings.PNG)

#### Enable Save-Data support

If yes, when the client sends Save-Data headers, optimizations are enforced regardless which settings you have configured.

#### HTTP Server Timing

Send HTTP Server Timing headers. They can be viewed in the google chrome network panel. Click on the network panel -> Click on your web page -> Click on the timing tab on the right. It should be turned off on production.

![Server Timing](../images/Server-Timing.PNG)

#### DNS Prefetch

Enable or disable DNS prefetch

```
- Ignore: let the browser decide
- Enabled: tell the browser to enable DNS prefetch
- Disabled: tell the browser to turn off DNS prefetch
```

#### HTTP Push

Choose which resource type will be pushed to the browser using HTTP push. Your web server need to use HTTP/2 for this feature to work properly.

#### Cache File

If Yes send file with http caching headers. This helps loading the page faster on the next visit because the file will be loaded from the browser cache instead of the network. Whenever a file is modified a new URL is generated so that the user will not see outdated content.

#### Hashing Method

Algorithn chosen when generating cached URL.

```
- Time: use file last modified time
- Etag: use file content instead of last modified time.
```

#### Cache Prefix

Cached URLs prefix.

#### Max Age

Specify how long files are cached by the browser.

#### CORS Headers

If yes send CORS headers when cached files are requested.

#### Custom Mimetypes

Extend the type of files that support HTTP caching. By default the plugin will cache images, javascript, css, fonts, xml. If you want to add pdf and psd files you will add for example

```
pdf application/octetstream
psd application/octetstream
```

#### Custom Attributes

Extend the list of attributes scanned in order to get urls of resources to cache. If you use lazylaoding, you might want to use custom attributes in order to store full size image. You can specify these here like that

```
data-href
data-src
data-srcset
```

### CDN

Configure CDN settings.

This feature allow you to serve files from a different cookieless domain on your server. You create a different domain that point to the same root as your web site.

![CDN settings](../images/cdn-settings.PNG)

#### Enable CDN

Enable or disable the CDN feature.

#### Access Control Allow Origin

Value send in the *Access Control Allow Origin* HTTP header. The default value is *\**

#### Redirect CDN Request

If a user access your cdn host name directly, he will be redirected to the url you specify here.

#### CDN1, CDN2, CDN3

CDN host names from which files will be loaded.

#### Enable static domain for custom resources type

You can specify which custom resources will be served from your custom CDN. you may for example serve pdf from you cdn by adding

```
pdf application/octetstream
```

#### Use Static Domain

Specify Which resource are served from CDN domains.

### Images

Configure images settings.

![Images settings](../images/images-settings.PNG)

#### Process Images

Turn images feature ON or OFF

#### Enforce Width and Height Attributes

Whether or not enforce width and height attributes for all HTML \<IMG\> tags

#### Fetch Remote Images

Fetch images hosted on remote hosts and store them locally.

#### Convert Images to Webp

Convert images to Webp. Webp produce smaller images than jpg or png.

#### Ignored Images

Images that match any pattern you specify here will be ignored. Example

```
images/optimized/
images/thumbnails/
```

#### Crop Method

Algorithm use when resizing images. Values are

```
- Default
- Center
- Entropy
- Face Detection
```

#### Image Placeholder

Whether or not use an image placeholder. **Choosing a placeholder algorithm will enable images lazyloading**. Values are

```
- None
- SVG: use an svg image as the placeholder
- Low Quality Image: Generate a low quality image from the picture.
```

#### Responsive Images

Automatically generate responsive images

#### Responsive Image Breakpoints

Selected breakpoints from which responsive images will be generated. The algorithm used is whatever you have specified in the *CROP Method* parameter

#### Responsive CSS background Images

Automatically generate css background images

#### Responsive CSS Image Breakpoints

Selected breakpoints from which css background responsive images will be generated. The algorithm used is whatever you have specified in the *CROP Method* parameter



6 changes: 4 additions & 2 deletions gzip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</fields>
</fieldset>
<fieldset name="http_cache" label="HTTP" addfieldpath="/plugins/system/gzip/fields">
<field type="spacer" label="Configure HTTP" />
<field type="spacer" label="PLG_GZIP_FIELDSET_HTTP" />
<field type="spacer" hr="true" />
<fields name="gzip">
<field name="savedata" label="PLG_GZIP_FIELD_SAVE_DATA_LABEL" description="PLG_GZIP_FIELD_SAVE_DATA_DESCRIPTION" type="radio" class="btn-group" default="1">
Expand Down Expand Up @@ -96,6 +96,8 @@
</fields>
</fieldset>
<fieldset name="cdn" label="CDN">
<field type="spacer" label="PLG_GZIP_FIELDSET_CDN" />
<field type="spacer" hr="true" />
<fields name="gzip">
<field name="cnd_enabled" label="PLG_GZIP_FIELD_CDN_ENABLED_LABEL" description="PLG_GZIP_FIELD_CDN_ENABLED_DESCRIPTION" type="radio" class="btn-group" default="0">
<option value="1">JYes</option>
Expand All @@ -117,7 +119,7 @@
</fields>
</fieldset>
<fieldset name="images" label="Images">
<field type="spacer" label="Configure images settings" />
<field type="spacer" label="PLG_GZIP_FIELDSET_IMAGES" />
<field type="spacer" hr="true" />
<fields name="gzip">
<field name="imageenabled" label="PLG_GZIP_FIELD_IMAGE_ENABLED_LABEL" description="PLG_GZIP_FIELD_IMAGE_ENABLED_DESCRIPTION" type="radio" class="btn-group" default="0">
Expand Down
Binary file added images/Server-Timing.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cdn-settings.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/general-settings.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/http-settings.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/images-settings.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 17 additions & 13 deletions language/en-GB/en-GB.plg_system_gzip.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PLG_GZIP_FIELD_DEBUG_DESCRIPTION="Use non mnified javascript files and print deb
PLG_GZIP_FIELD_PWA_DEBUG_LABEL="Debug service worker"
PLG_GZIP_FIELD_PWA_DEBUG_DESCRIPTION="Use non minified service worker files and print debugging info in the console"

PLG_GZIP_FIELD_MIMETYPES_CUSTOM_LABEL="Custom mimetypes"
PLG_GZIP_FIELD_MIMETYPES_CUSTOM_LABEL="Custom Mimetypes"
PLG_GZIP_FIELD_CDN_MIMETYPES_CUSTOM_DESCRIPTION="Extend the list of files supported by the http cache. Use the format<br><b>[file extension] [mimetype]</b><br>Example<br>json application/json"
PLG_GZIP_FIELD_CDN_MIMETYPES_CUSTOM_HINT="gif image/gif
json application/json
Expand All @@ -41,8 +41,8 @@ data-scrset"
PLG_GZIP_FIELD_METAGENERATOR_LABEL="Meta Generator"
PLG_GZIP_FIELD_METAGENERATOR_DESCRIPTION="Override meta generator=joomla by the text you provide here"

PLG_GZIP_FIELD_H2PUSH_LABEL="Use HTTP/2 Push"
PLG_GZIP_FIELD_H2PUSH_DESCRIPTION="The web server must support http/2 push"
PLG_GZIP_FIELD_H2PUSH_LABEL="HTTP/2 Push"
PLG_GZIP_FIELD_H2PUSH_DESCRIPTION="The web server must support http/2"

PLG_GZIP_FIELD_H2PUSH_OPTION_ALL="All supported types"
PLG_GZIP_FIELD_H2PUSH_OPTION_CSS="Stylesheet"
Expand All @@ -51,21 +51,21 @@ PLG_GZIP_FIELD_H2PUSH_OPTION_IMAGE="Images"
PLG_GZIP_FIELD_H2PUSH_OPTION_FONT="Fonts"
PLG_GZIP_FIELD_H2PUSH_OPTION_MEDIA="Media"

PLG_GZIP_FIELD_CACHEFILES_LABEL="Cache file"
PLG_GZIP_FIELD_CACHEFILES_LABEL="Cache File"
PLG_GZIP_FIELD_CACHEFILES_DESCRIPTION="Enable HTTP Cache for files"

PLG_GZIP_FIELD_CHECKSUM_LABEL="Subresource Integrity Checksum"
PLG_GZIP_FIELD_CHECKSUM_DESCRIPTION="Prevent file tampering by adding a signature. This feature is used for css and javascript only"

PLG_GZIP_FIELD_HASHFILES_LABEL="Hashing method"
PLG_GZIP_FIELD_HASHFILES_LABEL="Hashing Method"
PLG_GZIP_FIELD_HASHFILES_DESCRIPTION="Everytime a file is modified, a new url is generated. Choose whether the hash is based on last modification time or file content (ETag)"
PLG_GZIP_FIELD_HASHFILES_OPTION_TIME="Time"
PLG_GZIP_FIELD_HASHFILES_OPTION_CONTENT="Etag"

PLG_GZIP_FIELD_CDN_REDIRECT_LABEL="Redirect CDN request to your main website"
PLG_GZIP_FIELD_CDN_REDIRECT_DESCRIPTION="If you created your CDN through domains alias or CNAME you website content may be accessible via these URLS. You can redirect all those requests to your main website"
PLG_GZIP_FIELD_CDN_REDIRECT_LABEL="Redirect CDN Request"
PLG_GZIP_FIELD_CDN_REDIRECT_DESCRIPTION="If you created your CDN through domains alias or CNAME your website content may be accessible via these URLS. You can redirect all those requests to the urls to the url specified here"

PLG_GZIP_FIELD_MAXAGE_LABEL="Max age"
PLG_GZIP_FIELD_MAXAGE_LABEL="Max Age"
PLG_GZIP_FIELD_MAXAGE_DESCRIPTION="How long files will be kept in the browser cache"

JOPTION_MAXAGE_UNIT_MINUTES="Minutes"
Expand All @@ -90,7 +90,7 @@ PLG_GZIP_FIELD_PWA_CACHE_STRATEGY_FONTS_DESCRIPTION=""
PLG_GZIP_FIELD_PWA_CACHE_STRATEGY_HTML_LABEL="HTML Documents"
PLG_GZIP_FIELD_PWA_CACHE_STRATEGY_HTML_DESCRIPTION=""

PLG_GZIP_FIELD_CDN_CORS_LABEL="Send CORS headers"
PLG_GZIP_FIELD_CDN_CORS_LABEL="CORS Headers"
PLG_GZIP_FIELD_CDN_CORS_DESCRIPTION=""

PLG_GZIP_FIELD_CDN_ACCESS_CONTROL_ORIGIN_LABEL="Access Control Allow Origin"
Expand All @@ -107,13 +107,13 @@ PLG_GZIP_FIELD_CDN_0_DESCRIPTION="Use a cookieless or CDN domain to serve static
PLG_GZIP_FIELD_CDN_1_DESCRIPTION="Use a cookieless or CDN domain to serve static assets"
PLG_GZIP_FIELD_CDN_2_DESCRIPTION="Use a cookieless or CDN domain to serve static assets"

PLG_GZIP_FIELD_CDN_TYPES_DEFAULT_LABEL="Use static domain"
PLG_GZIP_FIELD_CDN_TYPES_DEFAULT_LABEL="Use Static Domain"
PLG_GZIP_FIELD_CDN_TYPES_DEFAULT_DESCRIPTION="Use static domain for these file types"

PLG_GZIP_FIELD_CDN_TYPES_LABEL="Enable static domain"
PLG_GZIP_FIELD_CDN_TYPES_DESCRIPTION="Enable static domain per resource type"

PLG_GZIP_FIELD_CDN_TYPES_CUSTOM_LABEL="Enable static domain for custom resources type"
PLG_GZIP_FIELD_CDN_TYPES_CUSTOM_LABEL="Enable Static Domain for Custom Resources Type"
PLG_GZIP_FIELD_CDN_TYPES_CUSTOM_HINT="png image/png
jpg image/jpeg
mp3 audio/mpeg"
Expand Down Expand Up @@ -203,13 +203,13 @@ PLG_GZIP_FIELD_IMAGE_SVG_PLACE_HOLDER_DESCRIPTION=""
JOPTION_IMAGESVGPLACEHOLDER_SVG="SVG"
JOPTION_IMAGESVGPLACEHOLDER_LQIP="Low quality image"

PLG_GZIP_FIELD_IMAGE_CSS_RESIZE_LABEL="Resize CSS background images"
PLG_GZIP_FIELD_IMAGE_CSS_RESIZE_LABEL="Responsive CSS background Images"
PLG_GZIP_FIELD_IMAGE_CSS_RESIZE_DESCRIPTION=""

PLG_GZIP_FIELD_IMAGE_CONVERT_LABEL="Convert to Webp"
PLG_GZIP_FIELD_IMAGE_CONVERT_DESCRIPTION="Webp produce smaller images"

PLG_GZIP_FIELD_IMAGEIGNORE_LABEL="Ignored Image"
PLG_GZIP_FIELD_IMAGEIGNORE_LABEL="Ignored Images"
PLG_GZIP_FIELD_IMAGEIGNORE_DESCRIPTION="Images matching any of these patterns will not be optimized"
PLG_GZIP_FIELD_IMAGEIGNORE_HINT="Example: /images/optimized/"

Expand Down Expand Up @@ -674,3 +674,7 @@ PLG_GZIP_FIELD_CSP_CONNECT_DESCRIPTION=""
PLG_GZIP_FIELD_CSP_CONNECT_CUSTOM_LABEL="Custom Connect Settings"
PLG_GZIP_FIELD_CSP_CONNECT_DESCRIPTION=""
PLG_GZIP_FIELD_CSP_CONNECT_HINT="'self'"

PLG_GZIP_FIELDSET_HTTP="Configure HTTP settings"
PLG_GZIP_FIELDSET_CDN="Configure CDN settings"
PLG_GZIP_FIELDSET_IMAGES="Configure images settings"

0 comments on commit 4978106

Please sign in to comment.