{"id":21525814,"url":"https://github.com/bkwld/nuxt-remote-asset-cache","last_synced_at":"2025-03-17T18:19:58.105Z","repository":{"id":40927439,"uuid":"215605297","full_name":"BKWLD/nuxt-remote-asset-cache","owner":"BKWLD","description":"Store remote assets in the local build during Nuxt generation","archived":false,"fork":false,"pushed_at":"2024-03-18T15:44:50.000Z","size":142,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T15:52:03.857Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","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/BKWLD.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-10-16T17:25:54.000Z","updated_at":"2022-01-14T16:20:29.000Z","dependencies_parsed_at":"2024-03-18T17:03:36.077Z","dependency_job_id":"91edf629-6117-445f-ae87-6767972ed6ff","html_url":"https://github.com/BKWLD/nuxt-remote-asset-cache","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fnuxt-remote-asset-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fnuxt-remote-asset-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fnuxt-remote-asset-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fnuxt-remote-asset-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BKWLD","download_url":"https://codeload.github.com/BKWLD/nuxt-remote-asset-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244085008,"owners_count":20395523,"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-11-24T01:38:32.738Z","updated_at":"2025-03-17T18:19:58.085Z","avatar_url":"https://github.com/BKWLD.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nuxt-remote-asset-cache\n\nThis stores remote assets, like images, that are referenced in the `asyncData` of a Nuxt page in some local directory that isn't destroyed between successive `generate` calls.  This was written, in particular, for Netlify and it's `NETLIFY_CACHE_DIR`.\n\n## Example\n\n#### nuxt.config.js\n```js\n{\n  modules: [\n    \t'nuxt-remote-asset-cache',\n  ]\n  \n  /**\n   * This would download anything in the data returned from asyncData with a\n   * URL like http://cms.hostname.com/images/file.jpg to the directory path\n   * from $NETLIFY_CACHE_DIR.  In addition, they will be published on every\n   * generate into /dist/images/file.jpg (for example)\n   */\n  remoteAssetCache: {\n    cacheDir: process.env.NETLIFY_CACHE_DIR,\n    assetRegex: [\n      {\n        pattern: /https?:\\/\\/cms\\.hostname\\.com\\/images\\/([\\w\\d-.\\/]+)/gi,\n        replacement: {\n          storagePath: \"/images/$1\",\n          publicUrl: \"#{process.env.URL}/images/$1\",\n          autoLowercase: true,\n        }\n      }\n    ]\n  }\n}\n```\n\n#### pages/home.vue\n```html\n\u003cscript\u003e\nexport default {\n  asyncData ({$cacheAssets}) {\n    // Fetch some data from somewhere\n    const data = { marquee: { \n      headline: 'Hi',\n      background: 'http://cms.hostname.com/images/file.jpg'\n    }}\n    return $cacheAssets(data)\n  }\n}\n\u003c/script\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fnuxt-remote-asset-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbkwld%2Fnuxt-remote-asset-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fnuxt-remote-asset-cache/lists"}