{"id":16956970,"url":"https://github.com/jgraichen/rails-assets-manifest","last_synced_at":"2025-03-22T13:31:55.767Z","repository":{"id":35055130,"uuid":"159193326","full_name":"jgraichen/rails-assets-manifest","owner":"jgraichen","description":"Load all assets from a manifest (e.g. from webpack) including SRI support","archived":false,"fork":false,"pushed_at":"2025-01-22T18:51:41.000Z","size":105,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-15T08:48:11.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jgraichen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-26T15:43:47.000Z","updated_at":"2025-01-22T18:51:25.000Z","dependencies_parsed_at":"2024-10-28T13:20:25.672Z","dependency_job_id":"0aae17ff-dd09-4824-b070-fd031ec31e18","html_url":"https://github.com/jgraichen/rails-assets-manifest","commit_stats":{"total_commits":60,"total_committers":2,"mean_commits":30.0,"dds":0.01666666666666672,"last_synced_commit":"b527c3566783511a09b82d2f215e3610e5a951db"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Frails-assets-manifest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Frails-assets-manifest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Frails-assets-manifest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Frails-assets-manifest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgraichen","download_url":"https://codeload.github.com/jgraichen/rails-assets-manifest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244962917,"owners_count":20539246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-13T22:16:30.027Z","updated_at":"2025-03-22T13:31:55.747Z","avatar_url":"https://github.com/jgraichen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rails::Assets::Manifest\n\n[![Gem Version](https://img.shields.io/gem/v/rails-assets-manifest?logo=ruby)](https://rubygems.org/gems/rails-assets-manifest)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/jgraichen/rails-assets-manifest/test.yml?logo=github)](https://github.com/jgraichen/rails-assets-manifest/actions)\n\nLoad all assets in your Rails application from a `manifest.json`, e.g. generated by [webpack-assets-manifest](https://github.com/webdeveric/webpack-assets-manifest).\n\nThis gem does not make any assumption on which tool to use to make your assets not how to configure or invoke it. It only requires a manifest JSON. The manifest must either be a simple string map or must map to objects having a `'src'` attribute. Sub-resource integrity is supported too:\n\n```json\n{\n  \"application.css\": {\n    \"src\": \"2b16adf6f756625a0194.css\",\n    \"integrity\": \"sha384-/oreyvcV6U6htGZD0fDWR8/Txezke8KhD0QNgHb660hSaW7M+ZzxxuB4Vo+PuAC9\"\n  },\n  \"application.js\": {\n    \"src\": \"2b16adf6f756625a0194.js\",\n    \"integrity\": \"sha384-iJ55fQQApbQGxWEWSbWStBabi+yNGxZSQy/010+1Dhxl+rymyhGF4NtjUkOsYv7B\"\n  }\n}\n```\n\nThis gem does not add new helper methods but extends the existing helpers. SRI is automatically added if available and within a secure context. A `crossorigin=\"anonymous\"` attribute is automatically added if non is present.\n\n```slim\nhtml\n  head\n    = stylesheet_link_tag 'application', media: 'all'\n    = javascript_include_tag 'application'\n```\n\n```html\n\u003clink rel=\"stylesheet\" media=\"all\" href=\"2b16adf6f756625a0194.css\" integrity=\"sha384-/oreyvcV6U6htGZD0fDWR8/Txezke8KhD0QNgHb660hSaW7M+ZzxxuB4Vo+PuAC9\" crossorigin=\"anonymous\"\u003e\n\u003cscript src=\"2b16adf6f756625a0194.js\" integrity=\"sha384-iJ55fQQApbQGxWEWSbWStBabi+yNGxZSQy/010+1Dhxl+rymyhGF4NtjUkOsYv7B\" crossorigin=\"anonymous\"\u003e\u003c/script\u003e\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rails-assets-manifest'\n```\n\n## Usage\n\nThe manifest path can be configured e.g. in an `environments/*.rb` file:\n\n```ruby\n  config.assets_manifest.path = \"public/.asset-manifest.json\"\n```\n\nIf `config.cache_classes` is set to `true` the manifest file be loaded once on boot. Assets included with `integrity: true` will raise an error if the integrity option is missing in the manifest.\n\n## Webpack Assets Manifest Example\n\nThe following snippet provides an example configuration for the[webpack-assets-manifest](https://github.com/webdeveric/webpack-assets-manifest) plugin to generating a compatible assets manifest file.\n\n```ts\nnew WebpackAssetsManifest({\n  integrity: true,\n  integrityHashes: [\"sha384\"],\n  writeToDisk: true,\n  entrypoints: false,\n  entrypointsUseAssets: true,\n  publicPath,\n  // Ignore a source maps and compressed files.\n  customize(e) {\n    if (e.key.endsWith(\".map\") || e.key.endsWith(\".gz\")) {\n      return false;\n    }\n\n    return e;\n  },\n})\n```\n\nSpecifying `writeToDisk: true` allows running the `webpack-dev-server` as proxy to the Rails application, and still generate correct assets links in Rails code. `rails-assets-manifest` defaults to using `public/assets/assets-manifest.json` as the manifest path.\n\n## TODO\n\n* Override/Join with `asset_host` URL?\n\n## Contributing\n\n1. [Fork it](http://github.com/jgraichen/rails-assets-manifest/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit specs for your feature so that I do not break it later\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create new Pull Request\n\n## MIT License\n\nCopyright (c) 2018-2022 Jan Graichen\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgraichen%2Frails-assets-manifest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgraichen%2Frails-assets-manifest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgraichen%2Frails-assets-manifest/lists"}