npm

Need private packages and team management tools?Check out npm Orgs. »

This package has been deprecated

Author message:

WARNING: This project has been renamed to webpack-asset-pipeline. Install using webpack-asset-pipeline instead.

webpack-rails-manifest-plugin

1.1.0 • Public • Published

webpack-rails-manifest-plugin

A missing link to Webpack and Ruby on Rails integration.

Build Status npm version

This plugin can be used to flush a list of your assets to a manifest.json file and replace the asset pipeline.

Rails

Requiring assets in Rails will be a bit different and needs some configuration. Read our Rails helper documentation.

Usage

This is a Webpack plugin that creates a manifest file for your assets. It can output files to Webpack (as emitting) or as a file on the filesystem.

npm install --save-dev webpack-rails-manifest-plugin

In your webpack.config.js file specify the plugin:

const RailsManifestPlugin = require('webpack-rails-manifest-plugin');
 
{
  plugins: [
    new RailsManifestPlugin()
  ]
}

You'll find the manifest.json file in your output directory. You can read ore about the options here.

Requiring images

All images have to be required in the JavaScript in order for webpack to process them, except the ones you require in your scss file (because wepback is processing your scss file adready)

You can create a new file which will hold all the images, e.g. files.js

require('images/file1.jpg');
require('images/file2.jpg');
require('images/file3.jpg');

And then in application.js (your entrypoint)

require('files');

You can see an example configuration and its documentation here.

Output

Once you set everything up, you should see this in your manifest.json file:

{
  "images/file1.jpg": "963eb32907744d9a0d6b98127162808f.jpg",
  "images/file2.jpg": "162808f4d9a0963eb3290774127d6b98.jpg",
  "images/file3.jpg": "d6b98127162969a0808f3eb32907744d.jpg"
}

Compatibility

This plugin is compatible with Webpack 1.x and 2.x. For rails compatibility please see our Rails helper documentation.

License

The MIT License

© 2016 Infinum Inc.

install

npm i webpack-rails-manifest-plugin

Downloadsweekly downloads

63

version

1.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability