asset-map-webpack-plugin
Webpack plugin that creates a map of assets to public url slug for server agnostic usage.
Last updated a year ago by schneidmaster .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install asset-map-webpack-plugin 
SYNC missed versions from official npm registry.

Webpack Asset Map Plugin

Build Status

Creates a json file that any server side technology can consume for asset declarations. Example output file:

{
  "assets": {
    "./smiley.jpeg": "/assets/smiley-db4f287d06928156270ca185fef0e026.jpeg",
    "./test-checklist.jpeg": "/assets/test-checklist-b3b0fe76f4485db43467876f664d1f62.jpeg"
  },
  "chunks": {
    "index": [
      "/assets/index-2c9c445686f51177cf62.js"
      "/assets/index-2c9c445686f51177cf62.css"
    ]
  }
}

The key is the relative path from the generated file to the image location in your source location. The value is the public url slug generated by webpack.

Usage

For webpack 1, use version 2.x of asset-map-webpack-plugin; for webpack 2/3, use version 3.x.

Add to the plugins array in your webpack config:

import AssetMapPlugin from 'asset-map-webpack-plugin';

export default {
  ...
  plugins: [
    /**
     * AssetMapPlugin
     *
     * @param {string} outputFile - What to name the output JSON file (written to the same directory as the other webpack assets)
     * @param {string} [relativeTo] - Key assets relative to this path, otherwise defaults to be relative to webpack `path`
     */
    new AssetMapPlugin(outputFilename, relativeTo)
  ]
};

Current Tags

  • 3.0.0                                ...           latest (a year ago)

13 Versions

  • 3.0.0                                ...           a year ago
  • 2.0.0                                ...           2 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (2)
Dev Dependencies (14)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |