Coder Social home page Coder Social logo

bernardodiasc / filestojson Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 254 KB

Generates JSON from static files [stable]

Home Page: https://bernardodiasc.github.io/filestojson/

License: MIT License

JavaScript 100.00%
cms static-files static-database nodejs json javascript markdown frontmatter

filestojson's Introduction

filestojson

This script will generarate JSON file from content files.

Setup

npm install filestojson --save-dev

Note: you may have to install Babel globaly to be able to use this lib:

npm install -g babel-cli

Examples

What's the application of this? You may ask.

Check the examples of different front-end stacks loading the data and rendering the page:

npm run examples

How to use

Command line:

filestojson ./path/to/config.js

Script:

import config from './path/to/config.js'
filestojson(config)

Configuration

Please refer to the examples/config.js implementation for further example.

Explaining, the config is expected to return an object with the keys:

  • content should be a string for the content folder path, where all content types containing markdown, images and other suff are located;
  • output should be a string for the JSON file path that will be generated;
  • include should be an array of strings, where the strings are file extensions that will be included;
  • exclude should be an array of strings, where the strings are file name with the extension that will be ignored;
  • contentTypes should be an array of object, each object containing key and the content type translation function;

Content types and translations

... TBP ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.