Skip to content

Commit 718985e

Browse files
committed
releaseAutomat: release 4.2.0
1 parent fb89982 commit 718985e

10 files changed

Lines changed: 1216 additions & 2962 deletions

File tree

.snyk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
2+
version: v1.25.0
3+
ignore: {}
4+
# patches apply the minimum changes required to fix a vulnerability
5+
patch:
6+
'npm:lodash:20180130':
7+
- gulp-html-beautify > rcloader > lodash:
8+
patched: '2023-03-29T21:37:59.737Z'
9+
'npm:marked:20170907':
10+
- nunjucks-markdown-filter > marked:
11+
patched: '2023-03-29T21:37:59.737Z'
12+
'npm:minimatch:20160620':
13+
- gulp-upng > gulp > vinyl-fs > glob-stream > minimatch:
14+
patched: '2023-03-29T21:37:59.737Z'
15+
- gulp-upng > gulp > vinyl-fs > glob-stream > glob > minimatch:
16+
patched: '2023-03-29T21:37:59.737Z'
17+
- gulp-upng > gulp > vinyl-fs > glob-watcher > gaze > globule > minimatch:
18+
patched: '2023-03-29T21:37:59.737Z'
19+
- gulp-upng > gulp > vinyl-fs > glob-watcher > gaze > globule > glob > minimatch:
20+
patched: '2023-03-29T21:37:59.737Z'

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Front-end Gulp DevStack Changelog
22

3-
## 4.1.1 (2023-03-29)
3+
## 4.2.0 (<https://github.com/cebreus/gulp-devstack/compare/4.1.1...4.2.0>) (2023-03-29)
44

5-
> pnpm up
5+
> pnpm upr because of securitx reasons; gulp-imagemin v7 > 8
6+
7+
## 4.1.1 (<https://github.com/cebreus/gulp-devstack/compare/4.1.0...4.1.1>) (2023-03-29)
8+
9+
> pnpm upr because of securitx reasons
610
711
## Release [4.1.0](https://github.com/cebreus/gulp-devstack/compare/4.0.0...4.1.0) (2023-01-29)
812

content/pages/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ hero:
1111
<a class="btn btn-lg btn-outline-secondary mb-3" href="https://github.com/cebreus/gulp-devstack/releases/latest" target="_blank" rel="license noopener">Download</a>
1212
</div>
1313
14-
Currently **v4.1.1** &#160;·&#160; <a class="link-secondary" href="https://github.com/cebreus/gulp-devstack/releases" target="_blank" rel="license noopener">All releases</a>
14+
Currently **v4.2.0** &#160;·&#160; <a class="link-secondary" href="https://github.com/cebreus/gulp-devstack/releases" target="_blank" rel="license noopener">All releases</a>
1515
1616
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/16e0c62b123d4dbfb27c216f5107f464)](https://www.codacy.com/gh/cebreus/gulp-devstack/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=cebreus/gulp-devstack\&utm_campaign=Badge_Grade)
1717
![GitHub open issues](https://img.shields.io/github/issues/cebreus/gulp-devstack)

gulp-tasks/gulp-optimize-images.js

Lines changed: 42 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,57 @@
11
const gulp = require('gulp');
22
const gulpif = require('gulp-if');
3-
const imagemin = require('gulp-imagemin');
43
const log = require('fancy-log');
54
const mozjpeg = require('imagemin-mozjpeg');
65
const newer = require('gulp-newer');
76
const plumber = require('gulp-plumber');
87
const upng = require('gulp-upng');
98

10-
/**
11-
* @description Function for optimizing JPEG images
12-
* @param {string} input Path to JPEG files
13-
* @param {string} output Path to save files
14-
* @param {boolean} params.rewriteExisting Switcher for rewriting files
15-
* @returns {*} Optimized JPEG images
16-
*/
9+
async function loadPlugin(plugin) {
10+
try {
11+
const module = await import(plugin);
12+
return module.default || module;
13+
} catch (error) {
14+
log.error(`Failed to load plugin: ${plugin}`);
15+
throw error;
16+
}
17+
}
18+
19+
async function processImages(input, output, plugins, params = {}) {
20+
const imagemin = await loadPlugin('gulp-imagemin');
1721

18-
const optimizeJpg = (input, output, params = {}) => {
1922
const rewriteExisting = !!(
2023
params.rewriteExisting &&
2124
typeof params.rewriteExisting === 'boolean' &&
2225
params.rewriteExisting === true
2326
);
2427

2528
if (params.verbose) {
26-
log(` 🟡 Start: ${output}/*.jpg`);
29+
log(`🟡🟡🟡 Start: ${output}`);
2730
}
2831

2932
gulp
3033
.src(input)
3134
.pipe(plumber())
3235
.pipe(gulpif(!rewriteExisting, newer(output)))
33-
.pipe(
34-
imagemin([
35-
mozjpeg({
36-
quantTable: 3,
37-
dcScanOpt: 2,
38-
}),
39-
])
40-
)
36+
.pipe(imagemin(plugins))
4137
.pipe(gulp.dest(output))
4238
.on('end', () => {
4339
if (params.verbose) {
44-
log(` 🟡 End: ${output}/*.jpg`);
40+
log(`🟡🟡🟡 End: ${output}`);
4541
}
4642
params.cb();
4743
});
48-
};
44+
}
4945

50-
/**
51-
* @description Function for optimizing PNG images
52-
* @param {string} input Path to PNG files
53-
* @param {string} output Path to save files
54-
* @param {boolean} params.rewriteExisting Switcher for rewriting files
55-
* @returns {*} Optimized PNG images
56-
*/
46+
const optimizeJpg = async (input, output, params = {}) => {
47+
const plugins = [
48+
mozjpeg({
49+
quantTable: 3,
50+
dcScanOpt: 2,
51+
}),
52+
];
53+
await processImages(input, output, plugins, params);
54+
};
5755

5856
const optimizePng = (input, output, params = {}) => {
5957
const rewriteExisting = !!(
@@ -80,47 +78,23 @@ const optimizePng = (input, output, params = {}) => {
8078
});
8179
};
8280

83-
/**
84-
* @description Function for optimizing SVG images
85-
* @param {string} input Path to SVG files
86-
* @param {string} output Path to save files
87-
* @param {boolean} params.rewriteExisting Switcher for rewriting files
88-
* @returns {*} Optimized SVG images
89-
*/
90-
91-
const optimizeSvg = (input, output, params = {}) => {
92-
const rewriteExisting = !!(
93-
params.rewriteExisting &&
94-
typeof params.rewriteExisting === 'boolean' &&
95-
params.rewriteExisting === true
96-
);
97-
98-
if (params.verbose) {
99-
log(`🟡🟡🟡 Start: ${output}/*.svg`);
100-
}
101-
gulp
102-
.src(input)
103-
.pipe(plumber())
104-
.pipe(gulpif(!rewriteExisting, newer(output)))
105-
.pipe(
106-
imagemin([
107-
imagemin.svgo({
108-
plugins: [
109-
{
110-
removeViewBox: false,
111-
collapseGroups: true,
112-
},
113-
],
114-
}),
115-
])
116-
)
117-
.pipe(gulp.dest(output))
118-
.on('end', () => {
119-
if (params.verbose) {
120-
log(`🟡🟡🟡 End: ${output}/*.svg`);
121-
}
122-
params.cb();
123-
});
81+
const optimizeSvg = async (input, output, params = {}) => {
82+
const svgo = await loadPlugin('imagemin-svgo');
83+
const plugins = [
84+
svgo({
85+
plugins: [
86+
{
87+
name: 'removeViewBox',
88+
active: false,
89+
},
90+
{
91+
name: 'collapseGroups',
92+
active: true,
93+
},
94+
],
95+
}),
96+
];
97+
await processImages(input, output, plugins, params);
12498
};
12599

126100
module.exports = {

gulpconfig.build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const faviconGenConfig = {
9999
orientation: 'portrait',
100100
scope: '/',
101101
start_url: '/index.html',
102-
version: '4.1.1',
102+
version: '4.2.0',
103103
logging: false,
104104
html: 'favicons.njk',
105105
pipeHTML: true,

0 commit comments

Comments
 (0)