# webpack-gallery-plugin

> A webpack plugin to provide a global object representing a detailed gallery tree view

Latest version **1.1.0** (published 2021-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-gallery-plugin
pnpm add webpack-gallery-plugin
yarn add webpack-gallery-plugin
bun add webpack-gallery-plugin
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-08-10 |
| First published | 2021-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 31.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Charles Gruenais |
| Maintainers | yungezeit |
| Keywords | webpack, plugin, gallery, waterfall, tree, images, pictures |

## Links

- npm: https://www.npmjs.com/package/webpack-gallery-plugin
- Repository: https://github.com/Dschungelabenteuer/webpack-gallery-plugin
- Homepage: https://github.com/Dschungelabenteuer/webpack-gallery-plugin#readme
- Issues: https://github.com/Dschungelabenteuer/webpack-gallery-plugin/issues
- npm.io page: https://npm.io/package/webpack-gallery-plugin

## Dependencies (6)

- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [ffprobe](https://npm.io/package/ffprobe.md) ^1.1.2
- [node-glob](https://npm.io/package/node-glob.md) ^1.2.0
- [image-size](https://npm.io/package/image-size.md) ^0.9.3
- [schema-utils](https://npm.io/package/schema-utils.md) ^3.0.0
- [ffprobe-static](https://npm.io/package/ffprobe-static.md) ^3.0.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2021-08-10
- 1.0.1 (webpack4) — 2021-02-20
- 2.0.0 (webpack5) — 2021-02-17
- 2.0.1 — 2021-02-20
- 1.0.0 — 2021-02-17

## README

# webpack-gallery-plugin

A webpack plugin to provide a global object representing a detailed gallery tree view.

## Getting started

You first need to install `webpack-gallery-plugin` as a development dependency by running the following command:
```console
npm install webpack-gallery-plugin --save-dev
```

You can then add the plugin to your `webpack` config. For example:

```js
// webpack.config.js
const GalleryPlugin = require("webpack-gallery-plugin");

module.exports = {
  plugins: [
    new GalleryPlugin({
      source: '/assets',
    }),
  ],
};
```

## Options

| **Name**             | **Type**    | **Required** | **Default** | **Description**                                                 |
|----------------------|-------------|--------------|-------------|-----------------------------------------------------------------|
| **`source`**         | `{String}`  | `true`       | `undefined` | Path to the target folder, relative to the webpack config file. |
| **`publicPath`**     | `{String}`  | `false`      | `"/"`       | Public path of the target folder.                               |
| **`outputName`**     | `{String}`  | `false`      | `"default"` | Output name, generated constant will be `GALLERY_{outputName}`. |
| **`ignoreTypes`**    | `{Array}`   | `false`      | `undefined` | Ignored file types.                                             |
| **`ignorePatterns`** | `{Array}`   | `false`      | `[".*/"]`   | Ignore patterns.                                                |
| **`extensions`**     | `{Object}`  | `false`      | `undefined` | Custom extensions map.                                          |
| **`verbose`**        | `{Boolean}` | `false`      | `false`     | Verbose mode.                                                   |

## Supported file types

| **`Image`** | **`Audio`** | **`Video`** |
|-------------|-------------|-------------|
| `.bmp`      | `.mp3`      | `.mp4`      |
| `.cur`      | `.ogg`      | `.mov`      |
| `.dds`      | `.m4a`      | `.wmv`      |
| `.gif`      | `.flac`     | `.flv`      |
| `.ktx`      | `.wav`      | `.avi`      |
| `.png`      | `.wma`      | `.mkv`      |
| `.pnm`      | `.aac`      |             |
| `.pam`      |             |             |
| `.pbm`      |             |             |
| `.pfm`      |             |             |
| `.pgm`      |             |             |
| `.ppm`      |             |             |
| `.psd`      |             |             |
| `.svg`      |             |             |
| `.icon`     |             |             |
| `.jpg`      |             |             |
| `.jpeg`     |             |             |
| `.icns`     |             |             |
| `.tiff`     |             |             |
| `.webp`     |             |             |


## Custom extensions map

You can extend the default supported file typed by adding your own `extension: type` entries into
the option's `extensions` parameter.

**exemple**
```js
// webpack.config.js
const GalleryPlugin = require("webpack-gallery-plugin");

module.exports = {
  plugins: [
    new GalleryPlugin({
      source: '/assets',
      extensions: {
        tiff: 'image',
        mp4: 'audio',
        txt: 'poetry',
      },
    }),
  ],
};
```

> ⚠️ If you respecify any of the default supported file types through the `extensions` parameter, the
> default type (image/audio/video) will be overwritten.


> ⚠️ `type`s other than `image`, `audio`, `video` will be preserved but wont provide any relevant data
> but the `path `and an `id`.

## Provide additional details
Each sniffed folder can provide a `gallery.details.json` file which is being parsed to find and
concatenate any additional data of your choice (e.g. a simple description or its author). Simply
specify the relative file path as a key and its details as an object value.

---
_Source: https://npm.io/package/webpack-gallery-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
