{"id":25424414,"url":"https://github.com/ed-mare/webpack_manifest_plugin","last_synced_at":"2026-05-03T23:37:12.064Z","repository":{"id":56897995,"uuid":"100651872","full_name":"ed-mare/webpack_manifest_plugin","owner":"ed-mare","description":"Ruby gem that integrates with the Javascript webpack-manifest-plugin package. Provides a view helper for adding webpack managed assets in Rails templates.","archived":false,"fork":false,"pushed_at":"2020-11-25T00:11:44.000Z","size":129,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-30T20:07:02.589Z","etag":null,"topics":["rails","ruby","webpack","webpack-manifest-plugin"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ed-mare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-17T23:01:31.000Z","updated_at":"2020-11-25T00:11:47.000Z","dependencies_parsed_at":"2022-08-20T17:40:26.961Z","dependency_job_id":null,"html_url":"https://github.com/ed-mare/webpack_manifest_plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ed-mare/webpack_manifest_plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ed-mare%2Fwebpack_manifest_plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ed-mare%2Fwebpack_manifest_plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ed-mare%2Fwebpack_manifest_plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ed-mare%2Fwebpack_manifest_plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ed-mare","download_url":"https://codeload.github.com/ed-mare/webpack_manifest_plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ed-mare%2Fwebpack_manifest_plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32589262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rails","ruby","webpack","webpack-manifest-plugin"],"created_at":"2025-02-16T23:16:08.238Z","updated_at":"2026-05-03T23:37:12.049Z","avatar_url":"https://github.com/ed-mare.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebpackManifestPlugin\n\nThis Ruby gem provides a way to use assets managed with `webpack` in Rails templates. JavaScript package  [webpack-manifest-plugin](https://www.npmjs.com/package/webpack-manifest-plugin) outputs a JSON file that maps assets to file paths. File paths can change depending on a webpack configuration -- a development config usually doesn't version assets while a production config does. Webpack updates CSS and JavaScript files with the file paths it outputs but not Rails templates. This gem provides a view helper for including these assets in Rails views.\n\n##### Who would use this?\n\nThose who already have a webpack asset workflow and only need to reference webpack assets in Rails templates. Otherwise, use [webpacker](https://github.com/rails/webpacker).\n\n##### Example App\n\nhttps://github.com/ed-mare/webpackmanifestplugin-example\n\n## Usage\n\n**1) Install the [webpack-manifest-plugin](https://www.npmjs.com/package/webpack-manifest-plugin):**\n\n```shell\nnpm install --save-dev webpack-manifest-plugin\n```\n\n**2) Configure your `webpack.config.js` file(s) to use this package:**\n\n```javascript\n/* add the plugin */\nvar ManifestPlugin = require('webpack-manifest-plugin');\n\n/* in the plugins section */\nplugins: [\n  // ...\n  new ManifestPlugin({\n    // server public path\n    publicPath: '/assets/'\n  }),\n  // ...\n]\n```\n\nAnd manage your assets as you normally do with webpack.\n\n```shell\n# i,e.,\nwebpack -d -w\n```\nThere is a rake task for running webpack. Ctrl-c kills it when in watch mode.\n\n```shell\n# i,e.,\nrake webpack_manifest_plugin:build\n\n# with options\nrake webpack_manifest_plugin:build['-d -w --config webpack.config.prod.js']\"\n```\n\n**3) Add this gem to your Rails application Gemfile and run `bundle`:**\n\n```ruby\ngem 'webpack_manifest_plugin'\n```\n\nAnd then execute:\n\n```ruby\nbundle\n```\n\nIf you are creating a new Rails app, skip sprockets and yarn (unless you need yarn).\n\n```shell\nrails new --help\n#...\n[--skip-yarn], [--no-skip-yarn]                    # Don't use Yarn for managing JavaScript dependencies\n#...\n-S, [--skip-sprockets], [--no-skip-sprockets]          # Skip Sprockets files\n #...\n```\n\nIf you want UJS and actioncable, add to package.json (with appropriate versions):\n\n```JSON\n# package.json\n\"dependencies\": {\n    \"actioncable\": \"5.1.3\",\n    ...\n    \"rails-ujs\": \"5.1.3\",\n```\n\n**4) Configure the gem in initializers:**\n\n```ruby\n# Configurations:\n\n# webpack_cmd - Command to execute webpack. Defaults to 'webpack'.\n# cache_manifest - boolean - defaults to false. If set to true, it loads the\n#     JSON file once and caches it in WebpackManifestPlugin.configuration.manifest.\n#     If false, it lazy loads per request.\n# logger - defaults to Logger.new(STDOUT). Set to your Rails.logger or whatever\n#          logger you are using.\n\n# create config/initializers/webpack_manifest_plugin.rb file and\n# configure it for your app.\n\n# Example:\nWebpackManifestPlugin.configure do |c|\n  c.webpack_cmd = 'node node_modules/webpack/bin/webpack'\n  c.cache_manifest =  Rails.env.production? ?  true : false\n  c.logger = Rails.logger\nend\n```\n\n**5) Use the `webpack_manifest_path` view helper your Rails views:**\n\nA webpack-manifest-plugin file looks something like this:\n\n```JSON\n{\n  \"common.css\": \"/assets/stylesheets/common.css\",\n  \"common.js\": \"/assets/javascripts/common.js\",\n  \"fonts/fontawesome-webfont.eot\": \"/assets/fonts/fontawesome-webfont.eot\",\n  \"fonts/fontawesome-webfont.svg?v=4.6.3\": \"/assets/fonts/fontawesome-webfont.svg\",\n  \"fonts/fontawesome-webfont.ttf?v=4.6.3\": \"/assets/fonts/fontawesome-webfont.ttf\",\n  \"images/login_cover.jpg\": \"/assets/images/login_cover.jpg\",\n  \"images/panel_bg.png\": \"/assets/images/panel_bg.png\",\n  \"react.css\": \"/assets/stylesheets/react.css\",\n  \"react.js\": \"/assets/javascripts/react.js\",\n  \"welcome.css\": \"/assets/stylesheets/welcome.css\",\n  \"welcome.js\": \"/assets/javascripts/welcome.js\"\n}\n```\n\nSpecify the hash key in the `webpack_manifest_path` view helper:\n\n```html\n\u003cimg src=\"\u003c%= webpack_manifest_path(\"images/login_cover.jpg\") %\u003e\" /\u003e\n\u003clink href=\"\u003c%= webpack_manifest_path(\"common.css\") %\u003e\" rel=\"stylesheet\" type=\"text/css\"\u003e\n\u003cscript src=\"\u003c%= webpack_manifest_path(\"common.js\") %\u003e\"\u003e\u003c/script\u003e\n```\n\n## Development\n\n1) Build the docker image:\n\n```shell\ndocker-compose build --no-cache\n```\n\n2) Start docker image with an interactive bash shell:\n\n```shell\ndocker-compose run --rm gem\n```\n\n3) Once in bash session, code, run tests, start console, etc.\n\n*Run bundle install if binstubs are missing or install only the executables\nyou need. Be sure they are excluded in .gitignore.*\n\n```shell\n# run console with gem loaded\nbin/console\n\n# run tests\nbin/rspec\n\n# check for vulnerabilities\n bin/bundler-audit --update\n\n# lint\n#\nbin/rubocop lib spec\n```\n\n## Todo\n\n- Test with Rails 6 app.\n- Test rake tasks.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/ed-mare/webpack_manifest_plugin. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fed-mare%2Fwebpack_manifest_plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fed-mare%2Fwebpack_manifest_plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fed-mare%2Fwebpack_manifest_plugin/lists"}