Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2.9.3 #127

Merged
merged 5 commits into from
Feb 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# How to build scripts

Build all javascript files

```bash
./build.sh
```

## Service Worker Scripts

Definitions are located in ./config/rollup/rollup.config.js. After you update the definitions,
you need to update the build script with

```bash
npm run rollup-config
```

The updated script will be located in ./rollup.config.js

### Run the build script

```bash
node ./rollup.config.js
```

## Other javascript files

Definitions are located in ./config/terser/terser.config.js. After you update the definitions,
you need to update the build script with

```bash
npm run terser-config
```

The updated script will be located in ./terser.config.js

### Run the build script

```bash
node ./terser.config.js
```
27 changes: 15 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# Change History

## 2.9.0

- New [CSS parser](https://github.com/tbela99/css) and minifier #67
- Resize background images in inline css #116
- Preserve background transparency when resizing #117
- \[bug\] Fix an issue with responsive images #95
- \[bug\] PWA start_url missing from preloaded urls #113
- \[bug\] Cannot download sourcemap file #112
- \[bug\] fix an error in the service worker #104
- Convert CSS inline images to webp #93
- Parse and minify inline CSS attribute #105
## 2.9.3

- Do not remove quotes when some characters are present #126
- Fix notice when parse inline CSS is enabled #105
- Update version number #124
- Add missing onesignal javascript #125

## 2.9.2

fix bug that prevent installation

## 2.9.1

fix bug that prevent installation

## 2.8.1

- fix empty service worker files #102
- Fix empty service worker files #102

## 2.8.0

Expand Down
8 changes: 8 additions & 0 deletions config/rollup/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export const serviceworker = {
}
};

export const oneSignal = {
input: "./worker/src/onesignal/onesignal.js",
output: {
file: "./worker/dist/onesignal.js",
format: "iife"
}
};

export const serviceworkerAdmin = {
input: "worker/src/administrator/index.js",
output: {
Expand Down
46 changes: 28 additions & 18 deletions config/terser/terser.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
*/

const preamble = "/* do not edit this file! */";
const ECMA_VERSION = 5;

const compress = {
// ecma: 5,
// ecma: ECMA_VERSION,
// keep_fnames: true,
passes: 3,
toplevel: true,
Expand All @@ -29,7 +30,7 @@ const output = {
// output options
preamble,
beautify: true,
// ecma: 5, // specify one of: 5, 6, 7 or 8
// ecma: ECMA_VERSION, // specify one of: 5, 6, 7 or 8
comments: true
};

Expand All @@ -44,7 +45,7 @@ const minify = {
...output,
preamble: '',
beautify: false,
// ecma: 5, // specify one of: 5, 6, 7 or 8
// ecma: ECMA_VERSION, // specify one of: 5, 6, 7 or 8
comments: false
}
};
Expand All @@ -63,7 +64,7 @@ export const imageLoader = {
output: "./imagesloader.js",
config: {
// ie8: true,
ecma: 5,
ecma: ECMA_VERSION,
output,
warnings: true
}
Expand All @@ -74,7 +75,7 @@ export const bgStyles = {
output: "./bgstyles.js",
config: {
// ie8: true,
ecma: 5,
ecma: ECMA_VERSION,
output,
warnings: true
}
Expand All @@ -85,7 +86,7 @@ export const intersectionObserver = {
output: "./js/dist/intersection-observer.js",
config: {
// ie8: true,
ecma: 5,
ecma: ECMA_VERSION,
output,
warnings: true
}
Expand All @@ -97,7 +98,7 @@ export const imageLoaderMin = {
config: {
...minify,
// ie8: true,
ecma: 5 // specify one of: 5, 6, 7 or 8
ecma: ECMA_VERSION // specify one of: 5, 6, 7 or 8
}
};

Expand All @@ -107,7 +108,7 @@ export const bgStylesMin = {
config: {
...minify,
// ie8: true,
ecma: 5 // specify one of: 5, 6, 7 or 8
ecma: ECMA_VERSION // specify one of: 5, 6, 7 or 8
}
};

Expand All @@ -117,7 +118,7 @@ export const loaderMin = {
config: {
...minify,
// ie8: true,
ecma: 5 // specify one of: 5, 6, 7 or 8
ecma: ECMA_VERSION // specify one of: 5, 6, 7 or 8
}
};

Expand All @@ -127,7 +128,7 @@ export const libReadyMin = {
config: {
...minify,
...imagesOverride,
ecma: 5
ecma: ECMA_VERSION
}
};

Expand All @@ -137,7 +138,7 @@ export const libImageMin = {
config: {
...minify,
...imagesOverride,
ecma: 5
ecma: ECMA_VERSION
}
};

Expand All @@ -146,7 +147,16 @@ export const intersectionObserverMin = {
output: "./js/dist/intersection-observer.min.js",
config: {
...minify,
ecma: 5
ecma: ECMA_VERSION
}
};

export const oneSignalMin = {
input: "./worker/dist/onesignal.js",
output: "./worker/dist/onesignal.min.js",
config: {
...minify,
ecma: ECMA_VERSION
}
};

Expand All @@ -155,7 +165,7 @@ export const syncMin = {
output: "./worker/dist/sync.fallback.min.js",
config: {
...minify,
ecma: 5
ecma: ECMA_VERSION
}
};

Expand All @@ -164,7 +174,7 @@ export const browserPrefetchMin = {
output: "./worker/dist/browser.prefetch.min.js",
config: {
...minify,
ecma: 5
ecma: ECMA_VERSION
}
};

Expand All @@ -191,7 +201,7 @@ export const browserMin = {
output: "./worker/dist/browser.min.js",
config: {
...minify,
ecma: 5
ecma: ECMA_VERSION
}
};

Expand All @@ -200,7 +210,7 @@ export const browserAdminMin = {
output: "./worker/dist/browser.administrator.min.js",
config: {
...minify,
ecma: 5
ecma: ECMA_VERSION
}
};

Expand All @@ -209,7 +219,7 @@ export const browserSyncMin = {
output: "./worker/dist/browser.sync.min.js",
config: {
...minify,
ecma: 5
ecma: ECMA_VERSION
}
};

Expand All @@ -218,6 +228,6 @@ export const browserUninstallMin = {
output: "./worker/dist/browser.uninstall.min.js",
config: {
...minify,
ecma: 5
ecma: ECMA_VERSION
}
};
6 changes: 3 additions & 3 deletions gzip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="3.5" type="plugin" group="system" method="upgrade">
<name>plg_system_gzip</name>
<author>Thierry Bela</author>
<creationDate>August 2016</creationDate>
<copyright>Copyright (C) 2005 - 2016 Thierry Bela.</copyright>
<creationDate>Feb 2021</creationDate>
<copyright>Copyright (C) 2005 - 2021 Thierry Bela.</copyright>
<license>Released under dual license LGPL v3 | MIT</license>
<authorEmail>contact@tbela.net</authorEmail>
<authorUrl>https://tbela.net</authorUrl>
<version>2.9.2</version>
<version>2.9.3</version>
<description>PLG_SYSTEM_GZIP_XML_DESCRIPTION</description>
<files>
<folder>docs</folder>
Expand Down
1 change: 1 addition & 0 deletions helpers/CSS.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public function processHTML($html, array $options = [])
// parsing css can be expansive
// let do it only when needed
if (!empty($options['parseinlinecss']) &&
!empty($attributes['style']) &&
strpos($attributes['style'], 'background') !== false &&
strpos($attributes['style'], 'url(') !== false &&
!empty($attributes['style'])) {
Expand Down
2 changes: 1 addition & 1 deletion helpers/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function postProcessHTML ($html, array $options = []) {
$root = $options['webroot'];

//remove quotes from HTML attributes that does not contain spaces; keep quotes around URLs!
$html = preg_replace_callback('~([\r\n\t ])?([a-zA-Z0-9:]+)=(["\'])([^\s\3]*)\3([\r\n\t ])?~', function ($matches) use ($options, $root) {
$html = preg_replace_callback('~([\r\n\t ])?([a-zA-Z0-9:]+)=(["\'])([^\s="\'`]*)\3([\r\n\t ])?~', function ($matches) use ($options, $root) {

if ($matches[2] == 'style') {

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gzip",
"version": "2.9.2",
"version": "2.9.3",
"scripts": {
"build": "./build.sh",
"rollup-config": "./node_modules/rollup/dist/bin/rollup ./config/rollup/rollup.js -f iife --name=rollupConfig > ./rollup.config.js",
Expand Down
9 changes: 9 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
}
};

const oneSignal = {
input: "./worker/src/onesignal/onesignal.js",
output: {
file: "./worker/dist/onesignal.js",
format: "iife"
}
};

const serviceworkerAdmin = {
input: "worker/src/administrator/index.js",
output: {
Expand Down Expand Up @@ -69,6 +77,7 @@
libReady: libReady,
libImages: libImages,
serviceworker: serviceworker,
oneSignal: oneSignal,
serviceworkerAdmin: serviceworkerAdmin,
browserPrefetch: browserPrefetch,
sync: sync
Expand Down
Loading