Galerie und tage

This commit is contained in:
2021-11-23 17:56:26 +01:00
parent ff35366279
commit 5f873bee89
4693 changed files with 149659 additions and 301447 deletions

173
node_modules/gulp-imagemin/index.js generated vendored
View File

@@ -1,124 +1,91 @@
const path = require('path');
const log = require('fancy-log');
const PluginError = require('plugin-error');
const through = require('through2-concurrent');
const prettyBytes = require('pretty-bytes');
const chalk = require('chalk');
const imagemin = require('imagemin');
const plur = require('plur');
'use strict';
var path = require('path');
var gutil = require('gulp-util');
var through = require('through2-concurrent');
var assign = require('object-assign');
var prettyBytes = require('pretty-bytes');
var chalk = require('chalk');
var Imagemin = require('imagemin');
var plur = require('plur');
const PLUGIN_NAME = 'gulp-imagemin';
const defaultPlugins = ['gifsicle', 'jpegtran', 'optipng', 'svgo'];
module.exports = function (opts) {
opts = assign({
// TODO: remove this when gulp get's a real logger with levels
verbose: process.argv.indexOf('--verbose') !== -1
}, opts);
const loadPlugin = (plugin, ...args) => {
try {
return require(`imagemin-${plugin}`)(...args);
} catch (error) {
log(`${PLUGIN_NAME}: Couldn't load default plugin "${plugin}"`);
}
};
var totalBytes = 0;
var totalSavedBytes = 0;
var totalFiles = 0;
var validExts = ['.jpg', '.jpeg', '.png', '.gif', '.svg'];
const exposePlugin = plugin => (...args) => loadPlugin(plugin, ...args);
const getDefaultPlugins = () =>
defaultPlugins.reduce((plugins, plugin) => {
const instance = loadPlugin(plugin);
if (!instance) {
return plugins;
}
return plugins.concat(instance);
}, []);
module.exports = (plugins, options) => {
if (typeof plugins === 'object' && !Array.isArray(plugins)) {
options = plugins;
plugins = null;
}
options = {
// TODO: Remove this when Gulp gets a real logger with levels
silent: process.argv.includes('--silent'),
verbose: process.argv.includes('--verbose'),
...options
};
const validExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.svg'];
let totalBytes = 0;
let totalSavedBytes = 0;
let totalFiles = 0;
return through.obj({
maxConcurrency: 8
}, (file, encoding, callback) => {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
callback(null, file);
cb(null, file);
return;
}
if (file.isStream()) {
callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
cb(new gutil.PluginError('gulp-imagemin', 'Streaming not supported'));
return;
}
if (!validExtensions.includes(path.extname(file.path).toLowerCase())) {
if (options.verbose) {
log(`${PLUGIN_NAME}: Skipping unsupported image ${chalk.blue(file.relative)}`);
if (validExts.indexOf(path.extname(file.path).toLowerCase()) === -1) {
if (opts.verbose) {
gutil.log('gulp-imagemin: Skipping unsupported image ' + chalk.blue(file.relative));
}
callback(null, file);
cb(null, file);
return;
}
const localPlugins = plugins || getDefaultPlugins();
var imagemin = new Imagemin()
.src(file.contents)
.use(Imagemin.gifsicle({interlaced: opts.interlaced}))
.use(Imagemin.jpegtran({progressive: opts.progressive}))
.use(Imagemin.optipng({optimizationLevel: opts.optimizationLevel}))
.use(Imagemin.svgo({
plugins: opts.svgoPlugins || [],
multipass: opts.multipass
}));
(async () => {
try {
const data = await imagemin.buffer(file.contents, {
plugins: localPlugins
});
const originalSize = file.contents.length;
const optimizedSize = data.length;
const saved = originalSize - optimizedSize;
const percent = originalSize > 0 ? (saved / originalSize) * 100 : 0;
const savedMsg = `saved ${prettyBytes(saved)} - ${percent.toFixed(1).replace(/\.0$/, '')}%`;
const msg = saved > 0 ? savedMsg : 'already optimized';
if (saved > 0) {
totalBytes += originalSize;
totalSavedBytes += saved;
totalFiles++;
}
if (options.verbose) {
log(`${PLUGIN_NAME}:`, chalk.green('✔ ') + file.relative + chalk.gray(` (${msg})`));
}
file.contents = data;
callback(null, file);
} catch (error) {
callback(new PluginError(PLUGIN_NAME, error, {fileName: file.path}));
}
})();
}, callback => {
if (!options.silent) {
const percent = totalBytes > 0 ? (totalSavedBytes / totalBytes) * 100 : 0;
let msg = `Minified ${totalFiles} ${plur('image', totalFiles)}`;
if (totalFiles > 0) {
msg += chalk.gray(` (saved ${prettyBytes(totalSavedBytes)} - ${percent.toFixed(1).replace(/\.0$/, '')}%)`);
}
log(`${PLUGIN_NAME}:`, msg);
if (opts.use) {
opts.use.forEach(imagemin.use.bind(imagemin));
}
callback();
imagemin.run(function (err, files) {
if (err) {
cb(new gutil.PluginError('gulp-imagemin:', err, {fileName: file.path}));
return;
}
var originalSize = file.contents.length;
var optimizedSize = files[0].contents.length;
var saved = originalSize - optimizedSize;
var percent = originalSize > 0 ? (saved / originalSize) * 100 : 0;
var savedMsg = 'saved ' + prettyBytes(saved) + ' - ' + percent.toFixed(1).replace(/\.0$/, '') + '%';
var msg = saved > 0 ? savedMsg : 'already optimized';
totalBytes += originalSize;
totalSavedBytes += saved;
totalFiles++;
if (opts.verbose) {
gutil.log('gulp-imagemin:', chalk.green('✔ ') + file.relative + chalk.gray(' (' + msg + ')'));
}
file.contents = files[0].contents;
cb(null, file);
});
}, function (cb) {
var percent = totalBytes > 0 ? (totalSavedBytes / totalBytes) * 100 : 0;
var msg = 'Minified ' + totalFiles + ' ' + plur('image', totalFiles);
if (totalFiles > 0) {
msg += chalk.gray(' (saved ' + prettyBytes(totalSavedBytes) + ' - ' + percent.toFixed(1).replace(/\.0$/, '') + '%)');
}
gutil.log('gulp-imagemin:', msg);
cb();
});
};
module.exports.gifsicle = exposePlugin('gifsicle');
module.exports.jpegtran = exposePlugin('jpegtran');
module.exports.optipng = exposePlugin('optipng');
module.exports.svgo = exposePlugin('svgo');

20
node_modules/gulp-imagemin/license generated vendored
View File

@@ -1,9 +1,21 @@
MIT License
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,67 +1,50 @@
{
"name": "gulp-imagemin",
"version": "6.2.0",
"description": "Minify PNG, JPEG, GIF and SVG images",
"license": "MIT",
"repository": "sindresorhus/gulp-imagemin",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"gulpplugin",
"imagemin",
"image",
"img",
"picture",
"photo",
"minify",
"minifier",
"compress",
"png",
"jpg",
"jpeg",
"gif",
"svg"
],
"dependencies": {
"chalk": "^2.4.1",
"fancy-log": "^1.3.2",
"imagemin": "^7.0.0",
"plugin-error": "^1.0.1",
"plur": "^3.0.1",
"pretty-bytes": "^5.3.0",
"through2-concurrent": "^2.0.0"
},
"devDependencies": {
"ava": "^2.3.0",
"get-stream": "^5.1.0",
"imagemin-pngquant": "^8.0.0",
"vinyl": "^2.2.0",
"xo": "^0.24.0"
},
"optionalDependencies": {
"imagemin-gifsicle": "^6.0.1",
"imagemin-jpegtran": "^6.0.0",
"imagemin-optipng": "^7.0.0",
"imagemin-svgo": "^7.0.0"
},
"peerDependencies": {
"gulp": ">=4"
},
"peerDependenciesMeta": {
"gulp": {
"optional": true
}
}
"name": "gulp-imagemin",
"version": "2.4.0",
"description": "Minify PNG, JPEG, GIF and SVG images",
"license": "MIT",
"repository": "sindresorhus/gulp-imagemin",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && mocha --timeout 50000"
},
"files": [
"index.js"
],
"keywords": [
"gulpplugin",
"imagemin",
"image",
"img",
"picture",
"photo",
"minify",
"minifier",
"compress",
"png",
"jpg",
"jpeg",
"gif",
"svg"
],
"dependencies": {
"chalk": "^1.0.0",
"gulp-util": "^3.0.0",
"imagemin": "^4.0.0",
"object-assign": "^4.0.1",
"plur": "^2.0.0",
"pretty-bytes": "^2.0.1",
"through2-concurrent": "^1.1.0"
},
"devDependencies": {
"imagemin-pngquant": "^4.1.0",
"xo": "*"
}
}

159
node_modules/gulp-imagemin/readme.md generated vendored
View File

@@ -1,8 +1,8 @@
# gulp-imagemin [![Build Status](https://travis-ci.com/sindresorhus/gulp-imagemin.svg?branch=master)](https://travis-ci.com/sindresorhus/gulp-imagemin) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo)
# gulp-imagemin [![Build Status](https://travis-ci.org/sindresorhus/gulp-imagemin.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-imagemin)
> Minify PNG, JPEG, GIF and SVG images with [`imagemin`](https://github.com/imagemin/imagemin)
> Minify PNG, JPEG, GIF and SVG images with [imagemin](https://github.com/kevva/imagemin)
*Issues with the output should be reported on the [`imagemin` issue tracker](https://github.com/imagemin/imagemin/issues).*
*Issues with the output should be reported on the imagemin [issue tracker](https://github.com/kevva/imagemin/issues).*
## Install
@@ -14,70 +14,20 @@ $ npm install --save-dev gulp-imagemin
## Usage
### Basic
```js
const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
const pngquant = require('imagemin-pngquant');
exports.default = () => (
gulp.src('src/images/*')
.pipe(imagemin())
.pipe(gulp.dest('dist/images'))
);
```
### Custom plugin options
```js
// …
.pipe(imagemin([
imagemin.gifsicle({interlaced: true}),
imagemin.jpegtran({progressive: true}),
imagemin.optipng({optimizationLevel: 5}),
imagemin.svgo({
plugins: [
{removeViewBox: true},
{cleanupIDs: false}
]
})
]))
// …
```
Note that you may come across an older, implicit syntax. In versions < 3, the same was written like this:
```js
// …
.pipe(imagemin({
interlaced: true,
progressive: true,
optimizationLevel: 5,
svgoPlugins: [
{
removeViewBox: true
}
]
}))
// …
```
### Custom plugin options and custom `gulp-imagemin` options
```js
// …
.pipe(imagemin([
imagemin.svgo({
plugins: [
{
removeViewBox: true
}
]
})
], {
verbose: true
}))
// …
gulp.task('default', () => {
return gulp.src('src/images/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest('dist/images'));
});
```
@@ -85,45 +35,74 @@ Note that you may come across an older, implicit syntax. In versions < 3, the sa
Comes bundled with the following **lossless** optimizers:
- [gifsicle](https://github.com/imagemin/imagemin-gifsicle) — *Compress GIF images*
- [jpegtran](https://github.com/imagemin/imagemin-jpegtran) — *Compress JPEG images*
- [optipng](https://github.com/imagemin/imagemin-optipng) — *Compress PNG images*
- [svgo](https://github.com/imagemin/imagemin-svgo) — *Compress SVG images*
- [gifsicle](https://github.com/kevva/imagemin-gifsicle) — *Compress GIF images*
- [jpegtran](https://github.com/kevva/imagemin-jpegtran) — *Compress JPEG images*
- [optipng](https://github.com/kevva/imagemin-optipng) — *Compress PNG images*
- [svgo](https://github.com/kevva/imagemin-svgo) — *Compress SVG images*
These are bundled for convenience and most users will not need anything else.
### imagemin(plugins?, options?)
### imagemin([options])
Unsupported files are ignored.
#### plugins
Type: `Array`<br>
Default: `[imagemin.gifsicle(), imagemin.jpegtran(), imagemin.optipng(), imagemin.svgo()]`
[Plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use. This will overwrite the default plugins. Note that the default plugins comes with good defaults and should be sufficient in most cases. See the individual plugins for supported options.
#### options
Type: `object`
Options are applied to the correct files.
##### verbose
##### optimizationLevel *(png)*
Type: `boolean`<br>
Type: `number`
Default: `3`
Select an optimization level between `0` and `7`.
> The optimization level 0 enables a set of optimization operations that require minimal effort. There will be no changes to image attributes like bit depth or color type, and no recompression of existing IDAT datastreams. The optimization level 1 enables a single IDAT compression trial. The trial chosen is what. OptiPNG thinks its probably the most effective. The optimization levels 2 and higher enable multiple IDAT compression trials; the higher the level, the more trials.
Level and trials:
1. 1 trial
2. 8 trials
3. 16 trials
4. 24 trials
5. 48 trials
6. 120 trials
7. 240 trials
##### progressive *(jpg)*
Type: `boolean`
Default: `false`
Enabling this will log info on every image passed to `gulp-imagemin`:
Lossless conversion to progressive.
```
gulp-imagemin: ✔ image1.png (already optimized)
gulp-imagemin: ✔ image2.png (saved 91 B - 0.4%)
```
##### interlaced *(gif)*
##### silent
Type: `boolean`<br>
Type: `boolean`
Default: `false`
Don't log the number of images that have been minified.
Interlace gif for progressive rendering.
You can also enable this from the command-line with the `--silent` flag if the option is not already specified.
##### multipass *(svg)*
Type: `boolean`
Default: `false`
Optimize svg multiple times until it's fully optimized.
##### svgoPlugins *(svg)*
Type: `array`
Default: `[]`
Customize which SVGO plugins to use. [More here](https://github.com/sindresorhus/grunt-svgmin#available-optionsplugins).
##### use
Type: `array`
Default: `null`
Additional [plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use with imagemin.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)