🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

webpack-plugin-asset-extractor

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-plugin-asset-extractor

Allows asset extraction to configurable path

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

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

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

NameTypeDefaultDescription
manifestStringasset-manifest.jsonConfigure a custom filename with generated assets map filename to url

Loader Options

NameTypeDefaultDescription
nameString or Function[hash].[ext]Configure a custom filename template for your file
contextStringthis.options.contextConfigure a custom file context, defaults to webpack.config.js context
publicPathString or Function/Configure a custom public path for your files
outputPathString or Function'undefined'Configure a custom output path for your files (within context)

FAQs

Package last updated on 23 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts