# webpack-plugin-asset-extractor

> Allows asset extraction to configurable path

Latest version **0.1.0** (published 2017-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-plugin-asset-extractor
pnpm add webpack-plugin-asset-extractor
yarn add webpack-plugin-asset-extractor
bun add webpack-plugin-asset-extractor
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2017-10-23 |
| First published | 2017-10-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | vertexbz |
| Maintainers | vertexbz |

## Links

- npm: https://www.npmjs.com/package/webpack-plugin-asset-extractor
- Repository: git@gitlab.lethe.vertaro:npm/webpack-plugin-asset-extractor
- npm.io page: https://npm.io/package/webpack-plugin-asset-extractor

## Dependencies (1)

- [loader-utils](https://npm.io/package/loader-utils.md) ^1.1.0

## Recent versions

- 0.1.0 (latest) — 2017-10-23

## README

# webpack-plugin-asset-extractor

This small webpack plugin allows you to set custom public paths for your assets as well as output paths. 
Main difference to `file-loader` is that *outputPath* and *publicPath* don't affect each other.  

## Usage

```js
const AssetExtractor = require('webpack-plugin-asset-extractor');

const imageExtractor = new AssetExtractor({
    manifest: 'assets.json'
});

module.exports = {
    // ...
    module: {
        rules: [
            // ...
            {
                test: /\.(gif|png|jpe?g|svg)$/i,
                use: [
                    imageExtractor.loader({
                        hash:'sha512',
                        digest:'hex',
                        name: '[hash].[ext]',
                        publicPath: '/assets/images/'
                    }),
                    {
                        loader: 'image-webpack-loader',
                        options: {
                            // ...
                        }
                    }
                ]
            }
        ]
    },
    plugins: [
        // ...
        imageExtractor
    ]
};
```

## Plugin Options

|Name|Type|Default|Description|
|:---:|:---:|:-----:|:----------|
|**`manifest`**|`String`|`asset-manifest.json`|Configure a custom filename with generated assets map filename to url|

## Loader Options

|Name|Type|Default|Description|
|:---:|:---:|:-----:|:----------|
|**`name`**|`String` or `Function`|`[hash].[ext]`|Configure a custom filename template for your file|
|**`context`**|`String`|`this.options.context`|Configure a custom file context, defaults to `webpack.config.js` [context](https://webpack.js.org/configuration/entry-context/#context)|
|**`publicPath`**|`String` or `Function`|`/`|Configure a custom `public` path for your files|
|**`outputPath`**|`String` or `Function`|`'undefined'`|Configure a custom `output` path for your files (within context)|

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