Saturday, 10 June 2017

Gulp task: how to write a JSON file that contains a list of files

I have a folder that contains audio files. Starting to this folder I need to write a manifest file.

This is the format of the manifests:

{
    "audio": [
        "assets/sounds/file1.mp3",
        "assets/sounds/file2.mp3",
        "assets/sounds/file3.mp3"
    ],
    "root": "assets/sounds"
}

the file are stored into the follow structure

root
  |_ dist
  |   |_ assets
  |        |_ audio.json
  |        |_ sounds
  |             |_ file1.mp3
  |             |_ file2.mp3
  |             |_ file3.mp3
  |
  |_ src
      |_ sounds
           |_ file1.mp3
           |_ file2.mp3
           |_ file3.mp3

I create the task that copy *.mp3 files from src/sounds to dist/assets/sounds

But I need some help to create a task to write the manifest file that will be located into dist/assets/audio.json



via Zauker

No comments:

Post a Comment