{"_id":"@superhuman/assets-webpack-plugin","_rev":"28-3669688df22f2a2e5504ba5c83b42337","name":"@superhuman/assets-webpack-plugin","dist-tags":{"latest":"3.4.2"},"versions":{"3.4.1":{"name":"@superhuman/assets-webpack-plugin","version":"3.4.1","keywords":["webpack","plugin","generate","assets","hashes"],"author":{"name":"Sebastian Porto"},"license":"MIT","_id":"@superhuman/assets-webpack-plugin@3.4.1","maintainers":[{"name":"cirwin","email":"conrad.irwin@gmail.com"}],"homepage":"https://github.com/sporto/assets-webpack-plugin","bugs":{"url":"https://github.com/sporto/assets-webpack-plugin/issues"},"dist":{"shasum":"f30db5b424c347c60f1f52a689bddc8cf3861611","tarball":"https://registry.npmjs.org/@superhuman/assets-webpack-plugin/-/assets-webpack-plugin-3.4.1.tgz","integrity":"sha512-FV0hCcCCKOa7f+HS9jQfTFKIKIAD76ntqvuihNU0Ttev1MT5LLk27grYhU8xrszPuwdyEYG/1VX0So0tnzhm+Q==","signatures":[{"sig":"MEQCIDa2NrH/vHd1bh8zpNAbSeqGc4bOdOTVGEXahpsbGHFTAiAf1Y7Be1/uIvCDktzggjNFLv46DWU6VicWG+dOoGr7/A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2cq1CRA9TVsSAnZWagAArFYP/RBLaq0BiR1eXPHDUeb0\nvtRGHnm6CyRRqhr7A3/XkinJ/djVirQLFXtEye9xPaoSfLfc18GJjqYnw3D/\nX6laWciyaCZ10HHg4tQgjjW+txmF6AU/Vdk6cc8TATJDuLFFN8QSutaBT0Ir\ni/c+SPEjK/14BCflEuljN0fj6RO/ESjeFP2cV8MEjzaQfyLPenDNWnwrzyfW\nSUsxPLG78ULb2ywWJzyHkfTEq7fHEK2z+XgNay7RLmxgA9pzHYQs1jM3jynY\nH0fk4HK1TG658KCNsAEsC+acEycVD7FV29nVwrVnYnh+7Aeyyehz+UG3m3jT\nwzKt7kCOoAYwGj2I4OzNMf/OpO6UV15IavpO5Uj2T6grz63o79cXgUtg9FYp\n4lj9AIpIh79CLmlVEmeOJYvt4BKJgvniQNwFmBwdT/EfsieWGUFmvkPRjPY9\nG6cw9ObsTO3Qft05IRA6HKLjUU52PBdOQKo+QVdDGjwHbIknwpETeEmXRF7L\nMId0nZ+iQxUsdqqPV5vahFr9tBNhBWHwHECICIGXYJeocvaFoY6U3Xaljv/3\nDlkJFkTpBGTvowjDTU4f4OH5tVAXilAmFMBPIm4Pc93pP8KWKP5R2eCFl7St\nOYU9+zgtvEvurlHkLiFfz8FRB7JgyRFtXRulQOZLQyQ+MZdw900h58M2aTZC\n7BHx\r\n=56uw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","_from":".","public":true,"_shasum":"f30db5b424c347c60f1f52a689bddc8cf3861611","gitHead":"f61c4fddb8752b6095178aea848de0f320edb6bd","scripts":{"tdd":"mocha test --watch","lint":"standard --verbose | snazzy","test":"mocha test"},"_npmUser":{"name":"cirwin","email":"conrad.irwin@gmail.com"},"repository":{"url":"git+https://github.com/sporto/assets-webpack-plugin.git","type":"git"},"_npmVersion":"3.10.9","description":"Emits a json file with assets paths","directories":{},"_nodeVersion":"7.2.0","dependencies":{"mkdirp":"^0.5.1","camelcase":"^1.2.1","lodash.merge":"^3.3.2","lodash.assign":"^3.2.0","escape-string-regexp":"^1.0.3"},"devDependencies":{"chai":"^3.0.0","mocha":"^2.2.5","lodash":"^3.9.3","rimraf":"^2.2.8","snazzy":"^3.0.0","webpack":"^1.3.3-beta1","standard":"^6.0.8","css-loader":"^0.9.1","file-loader":"^0.8.5","style-loader":"^0.8.3","extract-text-webpack-plugin":"^0.3.8"},"_npmOperationalInternal":{"tmp":"tmp/assets-webpack-plugin-3.4.1.tgz_1501025515101_0.4594269059598446","host":"s3://npm-registry-packages"}},"3.4.2":{"name":"@superhuman/assets-webpack-plugin","version":"3.4.2","keywords":["webpack","plugin","generate","assets","hashes"],"author":{"name":"Sebastian Porto"},"license":"MIT","_id":"@superhuman/assets-webpack-plugin@3.4.2","maintainers":[{"name":"superhumanengineering","email":"engineering+npm@superhuman.com"},{"name":"alif","email":"me@alifaiz.com"},{"name":"patrickdbakke","email":"patrickdbakke@gmail.com"},{"name":"timsuperhuman","email":"tim@superhuman.com"},{"name":"conrad-superhuman","email":"conrad@superhuman.com"},{"name":"cirwin","email":"conrad.irwin@gmail.com"},{"name":"gvohra","email":"gaurav@vohra.org.uk"},{"name":"gabeshahbazian","email":"gabeshahbazian@gmail.com"},{"name":"mkassoff_superhuman","email":"mkassoff@superhuman.com"}],"homepage":"https://github.com/sporto/assets-webpack-plugin","bugs":{"url":"https://github.com/sporto/assets-webpack-plugin/issues"},"dist":{"shasum":"d7ebdf07bb77e42aa82a9b2543e302546bccc653","tarball":"https://registry.npmjs.org/@superhuman/assets-webpack-plugin/-/assets-webpack-plugin-3.4.2.tgz","fileCount":37,"integrity":"sha512-uPCsm/R6kbjEH/Jkqy0b0IUtfzbLCRHDbbpGwvrG5NHwkzCZPedqlg47q+/fFucs61T3CUskCpZ9Mn3ujU6XzA==","signatures":[{"sig":"MEYCIQD4t78LPBn6GAwWYzYaSoFHMRL3Qn/nYy/5cZAfKSAnVQIhAMPKkLtXRTubbtCUGpFMEKWAcY9of0Ib60hnUV/paK4D","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":52988,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjXFvMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr81w/8CDCJOCQRlJ5wijLv3HpvB+EI1yozRLrC3CwrzgWU5cRYwKHd\r\nRUFX2zTXAn0nVXNfQkTkmmRC8TQqQinWT9AKGl11PPG6JZOUzNuuyOvZ1tKM\r\nuWz9wc5JN/Jpc9UVuLyNQwLliPS57Fuj9TSpJUsn4Sxi3EwYggNqQ9EmyVwR\r\nocIjg0eKj/3p8RzOp6unccnyr1LpxuV/ONHYIWsbpdMjnSE8lvevbCNFhSe9\r\nhIRC5YWuf0d3bKsINehTYzdAYKEAbAbkbqfXCeF7xpKxTotav+1ni3Z+kj5e\r\nEX14RptDMiLGMwfNjupc9r67xBBL9yhukD5jngCzZ86IyoqKLwXjPxhq5m8V\r\ndQ7M7LT/xA8kqBR0osjbfMlChetTH2eS7y/KZXHvA/N/IR8RP2y8sn7kWhtL\r\nKHij4HsK1vwBHZkV2bKji4t7qQ9aVvH2ooM5WMntDPPxdXi/HbPyEq/1PCpc\r\nsiIPgoYAKhJprxWf0vuhsESR9VO9ErzGjYjOuIBfvRFlr8SkMGAMy2ay+C8j\r\nxv5SnMl+UIohbHOQndzrQ6ZMxlIgAOlS+X+y4tf+DNlPCugs6VcmI1UWgd/9\r\nuK2bEUtoVTKgcMNlDqg61raCbEQNLT/oRCxcaXf28qZyjRetJF9/DX70XLqe\r\ndcpO/7cIsbWkGEBtPS3QLCKxWwPuWz5+MXM=\r\n=0z6q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"56ac46c613204581e42cf2106464417225f7a7c1","scripts":{"tdd":"mocha test --watch","lint":"standard --verbose | snazzy","test":"mocha test"},"_npmUser":{"name":"superhumanengineering","email":"engineering+npm@superhuman.com"},"overrides":{"minimist":">=1.2.6","glob-parent":">=5.1.2"},"repository":{"url":"git+https://github.com/sporto/assets-webpack-plugin.git","type":"git"},"_npmVersion":"8.19.2","description":"Emits a json file with assets paths","directories":{},"resolutions":{"minimist":">=1.2.6","glob-parent":">=5.1.2"},"_nodeVersion":"16.14.2","dependencies":{"mkdirp":"^0.5.1","camelcase":"^1.2.1","lodash.merge":"^4.6.2","lodash.assign":"^3.2.0","escape-string-regexp":"^1.0.3"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^3.0.0","mocha":"^10.1.0","lodash":"^4.17.21","rimraf":"^2.2.8","snazzy":"^9.0.0","webpack":"^1.3.3-beta1","standard":"^17.0.0","css-loader":"^0.9.1","file-loader":"^0.8.5","style-loader":"^0.8.3","extract-text-webpack-plugin":"^0.3.8"},"_npmOperationalInternal":{"tmp":"tmp/assets-webpack-plugin_3.4.2_1666997195886_0.12196512849099417","host":"s3://npm-registry-packages"}}},"time":{"created":"2017-07-25T23:31:55.176Z","modified":"2025-09-17T23:03:58.704Z","3.4.1":"2017-07-25T23:31:55.176Z","3.4.2":"2022-10-28T22:46:36.090Z"},"bugs":{"url":"https://github.com/sporto/assets-webpack-plugin/issues"},"author":{"name":"Sebastian Porto"},"license":"MIT","homepage":"https://github.com/sporto/assets-webpack-plugin","keywords":["webpack","plugin","generate","assets","hashes"],"repository":{"url":"git+https://github.com/sporto/assets-webpack-plugin.git","type":"git"},"description":"Emits a json file with assets paths","maintainers":[{"email":"tim@superhuman.com","name":"timsuperhuman"},{"email":"patrickdbakke@gmail.com","name":"patrickdbakke"},{"email":"engineering+npm@superhuman.com","name":"superhumanengineering"},{"email":"shivangi@superhuman.com","name":"shivangi_c"}],"readme":"# assets-webpack-plugin\n[![Build Status](https://travis-ci.org/kossnocorp/assets-webpack-plugin.svg?branch=master)](https://travis-ci.org/kossnocorp/assets-webpack-plugin) [![Build status](https://ci.appveyor.com/api/projects/status/qmvi3h6lk0xu8833?svg=true)](https://ci.appveyor.com/project/kossnocorp/assets-webpack-plugin)\n\nWebpack plugin that emits a json file with assets paths.\n\n## Table of Contents\n\n- [Why Is This Useful?](#why-is-this-useful)\n\n- [Install](#install)\n\n- [Configuration](#configuration)\n\n- [Test](#test)\n\n- [Change Log](./CHANGELOG.md)\n\n- [Contributing Guidelines](./CONTRIBUTING.md)\n\n## Why Is This Useful?\n\nWhen working with Webpack you might want to generate your bundles with a generated hash in them (for cache busting).\n\nThis plug-in outputs a json file with the paths of the generated assets so you can find them from somewhere else.\n\n### Example output:\n\nThe output is a JSON object in the form:\n\n```json\n{\n    \"entries\": {\n      \"bundle_name\": {\n          \"asset_kind\": \"/public/path/to/asset\"\n      }\n    },\n    \"assets\": [{\n        \"name\": \"hello.svg\",\n        \"path\": \"/public/path/to/asset/hello.svg\"\n      }\n    ]\n}\n```\n\nWhere:\n\n  * `entries` is an object that contains all entry points listed in your webpack config\n    * `\"bundle_name\"` is the name of the bundle (the key of the entry object in your webpack config, or \"main\" if your entry is an array).\n    * `\"asset_kind\"` is the camel-cased file extension of the asset\n  * `assets` is an array containing all assets processed by webpack\n    * `name` is the name of the image (path used in `require` or `import`)\n    * `path` is the webpack generated public path to the image\n\nFor example, given the following webpack config:\n\n```js\n{\n    entry: {\n        one: ['src/one.js'],\n        two: ['src/two.js']\n    },\n    output: {\n        path: path.join(__dirname, \"public\", \"js\"),\n        publicPath: \"/js/\",\n        filename: '[name]_[hash].bundle.js'\n    }\n}\n```\n\nand import of an image somewhere in application code using\n\n```js\nimport user from '../../assets/images/user.svg';\n```\n\nThe plugin will output the following json file:\n\n```json\n{\n    \"one\": {\n        \"js\": \"/js/one_2bb80372ebe8047a68d4.bundle.js\"\n    },\n    \"two\": {\n        \"js\": \"/js/two_2bb80372ebe8047a68d4.bundle.js\"\n    },\n    \"assets\":[{\n      \"name\":\"assets/images/user.svg\",\n      \"path\":\"/js/assets/images/user.svg\"\n    }]\n}\n```\n\n## Install\n\n```sh\nnpm install assets-webpack-plugin --save-dev\n```\n\n## Configuration\n\nIn your webpack config include the plug-in. And add it to your config:\n\n```js\nvar path = require('path')\nvar AssetsPlugin = require('assets-webpack-plugin')\nvar assetsPluginInstance = new AssetsPlugin()\n\nmodule.exports = {\n    // ...\n    output: {\n        path: path.join(__dirname, \"public\", \"js\"),\n        filename: \"[name]-bundle-[hash].js\",\n        publicPath: \"/js/\"\n    },\n    // ....\n    plugins: [assetsPluginInstance]\n}\n```\n\n### Options\n\nYou can pass the following options:\n\n__filename__: Name for the created json file. Defaults to `webpack-assets.json`\n\n```js\nnew AssetsPlugin({filename: 'assets.json'})\n```\n\n__fullPath__: True by default. If false the output will not include the full path of the generated file.\n\n```js\nnew AssetsPlugin({fullPath: false})\n```\n\ne.g.\n\n`/public/path/bundle.js` vs `bundle.js`\n\n__path__: Path where to save the created json file. Defaults to the current directory.\n\n```js\nnew AssetsPlugin({path: path.join(__dirname, 'app', 'views')})\n```\n\n__prettyPrint__: Whether to format the json output for readability. Defaults to false.\n\n```js\nnew AssetsPlugin({prettyPrint: true})\n```\n\n__processOutput__: Formats the assets output. Defaults is JSON stringify function.\n\n```js\nnew AssetsPlugin({\n    processOutput: function (assets) {\n        return 'window.staticMap = ' + JSON.stringify(assets)\n    }\n})\n```\n\n__update__: When set to true, the output json file will be updated instead of overwritten. Defaults to false.\n\n```js\nnew AssetsPlugin({update: true})\n```\n\n__metadata__: Inject metadata into the output file. All values will be injected into the key \"metadata\".\n\n```js\nnew AssetsPlugin({metadata: {version: 123}})\n\n// Manifest will now contain:\n// {\n//   metadata: {version: 123}\n// }\n```\n\n__assetsRegex__: Regex for assets that should be extracted from Webpack stats. Defaults to `/\\.(jpe?g|png|gif|svg)$/`\n\n```js\nnew AssetsPlugin({assetsRegex: /\\.(svg)$/})\n```\n\n\n### Using in multi-compiler mode\n\nIf you use webpack multi-compiler mode and want your assets written to a single file,\nyou __must__ use the same instance of the plugin in the different configurations.\n\nFor example:\n\n```js\nvar webpack = require('webpack')\nvar AssetsPlugin = require('assets-webpack-plugin')\nvar assetsPluginInstance = new AssetsPlugin()\n\nwebpack([\n    {\n        entry: {one: 'src/one.js'},\n        output: {path: 'build', filename: 'one-bundle.js'},\n        plugins: [assetsPluginInstance]\n    },\n    {\n        entry: {two:'src/two.js'},\n        output: {path: 'build', filename: 'two-bundle.js'},\n        plugins: [assetsPluginInstance]\n    }\n])\n```\n\n\n### Using this with Rails\n\nYou can use this with Rails to find the bundled Webpack assets via sprockets. In `ApplicationController` you might have:\n\n```ruby\ndef script_for(bundle)\n  path = Rails.root.join('app', 'views', 'webpack-assets.json') # This is the file generated by the plug-in\n  file = File.read(path)\n  json = JSON.parse(file)\n  json['entries'][bundle]['js']\nend\n```\n\nThen in the actions:\n\n```ruby\ndef show\n  @script = script_for('clients') # this will retrieve the bundle named 'clients'\nend\n```\n\nAnd finally in the views:\n\n```erb\n<div id=\"app\">\n  <script src=\"<%= @script %>\"></script>\n</div>\n```\n\n## Test\n\n```sh\nnpm test\n```\n","readmeFilename":"readme.md"}