Given a directory of files, output a JSON representation of their contents.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
my-files
.gitignore
Brocfile.js
README.md
index.js
package.json

README.md

broccoli-file-contents-to-json

Read in some files, output a JSON representation of their contents.

Check out the gulp equivalent here.

Installation

$ npm install broccoli-file-contents-to-json

How it works

Given a nested directory of files like so,

my-files
├── bar.txt
├── foo.txt
└── my-folder
    └── baz.txt

broccoli-file-contents-to-json reads in each file, and outputs a single JSON file, say output.json, representing the contents of each file within the folder. Here's an example output:

{
  "bar.txt": "Content of bar.",
  "foo.txt": "Contents of foo.",
  "my-folder/baz.txt": "Contents of baz."
}

Now, you can use output.json however you'd like.

How to Use

See the Brocfile packaged in this project for example usage.

rm -rf dist && broccoli build dist

Author

twitter/brianmgonzalez
Brian Gonzalez

License

MIT