Search code examples
ember-cli

Broccoli asset rev fingerprint urls in json file


My rails app and index.html file are hosted on heroku and the rest of the assets are on s3, there's a manifest.json file that is required in order to enable mobile web app mode for chrome on android that looks like:

{
  "short_name": "Kinlan's Amaze App",
  "name": "Kinlan's Amazing Application ++",
  "icons": [
    {
      "src": "launcher-icon-2x.png",
      "sizes": "96x96",
      "type": "image/png"
    },
    {
      "src": "launcher-icon-3x.png",
      "sizes": "144x144",
      "type": "image/png"
    },
    {
      "src": "launcher-icon-4x.png",
      "sizes": "192x192",
      "type": "image/png"
    }
  ],
  "start_url": "/index.html",
  "display": "standalone",
  "orientation": "landscape"
}

In my brocfile.js I have included the json extension to the list of fingerprintable files.

The actual file gets fingerprinted but the contents such as "src": "launcher-icon-3x.png" do not.

Anyway to do this or do I need to make an in-Repo addon to handle the creation of the file?


Solution

  • After looking through the source the following can be done by adding json to the replaceExtensions option:

    var app = new EmberApp({
      fingerprint: {
        prepend: fingerprint,
        extensions: ['js', 'css', 'png', 'jpg', 'gif', 'svg', 'json'],
        replaceExtensions: ['html', 'css', 'js', 'json']
      }
    });