GithubHelp home page GithubHelp logo

stevematney / asset-map-webpack-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mtscout6-team/asset-map-webpack-plugin

0.0 2.0 0.0 43 KB

Webpack plugin that creates a map of assets to public url slug for server agnostic usage.

JavaScript 98.89% CSS 1.11%

asset-map-webpack-plugin's Introduction

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

Add to the plugins array in your webpack config:

var AssetMapPlugin = require('asset-map-webpack-plugin');

module.exports = {
  ...
  plugins: [
    /**
     * AssetMapPlugin
     *
     * @param {string} outputFile - Where to write the asset map file
     * @param {string} [relativeTo] - Key assets relative to this path, otherwise defaults to be relative to the directory where the outputFile is written
     */
    new AssetMapPlugin(outputFilename, relativeTo)
  ]
};

asset-map-webpack-plugin's People

Contributors

mtscout6 avatar stevematney avatar slonoed avatar pierreant-p avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.