shonny-ua / gulp-rev-collector

Static asset revision data collector from manifests, with was generated from different streams and replace they's links in html template.
MIT License
149 stars 41 forks source link

Fix issue where rev detection fails with additional JSON files #27

Closed jacobwgillespie closed 8 years ago

jacobwgillespie commented 8 years ago

I have a copy task that copies over additional supporting files which include a manifest.json that is necessary for add to homescreen on Android. Currently copying this JSON file fails with gulp-rev-collector because it tries to take path.basename of an object. This PR adds a check to make sure the value is a string, fixing that error.

For reference, this is the JSON file that breaks the package (since it tries to take path.basename of the icons array):

{
  "name": "Half Staff",
  "icons": [
    {
      "src": "/images/icons/android-chrome-36x36.png",
      "sizes": "36x36",
      "type": "image/png",
      "density": 0.75
    },
    {
      "src": "/images/icons/android-chrome-48x48.png",
      "sizes": "48x48",
      "type": "image/png",
      "density": 1
    },
    {
      "src": "/images/icons/android-chrome-72x72.png",
      "sizes": "72x72",
      "type": "image/png",
      "density": 1.5
    },
    {
      "src": "/images/icons/android-chrome-96x96.png",
      "sizes": "96x96",
      "type": "image/png",
      "density": 2
    },
    {
      "src": "/images/icons/android-chrome-144x144.png",
      "sizes": "144x144",
      "type": "image/png",
      "density": 3
    },
    {
      "src": "/images/icons/android-chrome-192x192.png",
      "sizes": "192x192",
      "type": "image/png",
      "density": 4
    }
  ],
  "start_url": "https://halfstaff.co",
  "display": "standalone"
}