rev-replace-loader
Webpack loader to replace asset paths with hashed ones from a rev-manifest.json file
Last updated 5 years ago .
· Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rev-replace-loader 
SYNC missed versions from official npm registry.

Replace rev'd asset references in your production JS compiled with Webpack!

Example

Source File

var assetPath = "path/to/asset.jpg"

rev-manifest.json

{
  "path/to/asset.jpg": "path/to/asset-78950a808a.jpg"
}

Output

var assetPath = "path/to/asset-78950a808a.jpg"

Configuration

You can either pass a manifest object directly, or pass a manfiestPath for the loader to try. The latter will not error if no manifest file is found. Filenames will simply remain the same. The manifestPath parameter also supports glob queries.

There is optional prefix parameter - if given, it will be prepended to all queries to be replaced.

    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                loader: 'rev-replace',
                query: {
                    manifest: require('path/to/manifest'),
                    manifestPath: 'path/to/manifest',
                    prefix: '/'
                }
            }
        ]
    }
}

Current Tags

  • 0.4.0                                ...           latest (5 years ago)

7 Versions

  • 0.1.0                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.4                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
Dependencies (2)
Dev Dependencies (0)
None

Copyright © npmmirror.com | 浙ICP备15033595号-63 |