Code Monkey home page Code Monkey logo

matic's Introduction

Matic Build Status

A Node.js build tool for generating HTML documentation from JSON schemas.

Matic is currently in Alpha state and whilst usable for most use cases still lots of work remain as development continues. You are encouraged to fork the repo should you wish to contribute to the code and bug reports or suggestions will be attended to in the issue queue.

Current development was based on the draft JSON schema 03 specification and support for any follow up specifications will be ported as they become available.

Installation

Use NPM to install globally:

$ npm install -g

A sure indication that matic is installed and operational, which also retrieves the current version number, is to run the command:

$ matic -v

Building documentation

From the root of your project folder simply run:

$ matic

Example projects

There are currently two example projects available, which are full project folders not yet built with Matic, to aid as examples of how to structure your project folder to work with Matic:

  • very simple example. Which contains one schema file and one template file.
  • simple example. Which contains one schema file and a more structured template set-up with includes and mixins.

A more complex example which includes sub schema support is currently underway and will be available shortly.

A typical layout using default settings:

|____config.json
|____schemas
| |____my-awesome-schema.json
|____templates
| |____default.jade
|____web

Essentially you will need

  • a folder with at least one schema document
  • a folder with at least one template file
  • an optional config file for custom settings

The default global configuration looks for a main template with filename default.jade which can be customized with a project level config file, see below.

By default Matic will use your template(s) and schema(s) to generate a set of HTML files into a folder named web, this can also be modified through the local config file.

Setting config options

Various default settings are configured through Matic's global config file. These settings can be modified on a per project basis by providing a custom config.json file located at the root of the project folder.

The following parameters are configurable, default values in brackets:

Source [./schemas/]

The source folder is where Matic will look for JSON schema documents. These files can have any name with the .json extension.

Example:

{"source": "./schemas/"}

Target [./web/]

This is the output folder where Matic will generate the resulting HTML files. This folder will be created automatically, if it does not exist.

Example:

{"target": "./web/"}

Template

This is an object containing details of the templating language which you intend Matic to use to generate the HTML output. Please note only support for Jade has been tested to date, although it should work equally well with other libraries which implement the compile() and render() methods. If you do happen to have the opportunity to test Matic with an alternative provider, please report back with your findings.

The template configuration object has the following settings:

Path [./templates/]

The path to your template files.

File [default]

The name of your primary template file.

Lib [jade]

Name of the template library to use. Note: Matic will assume that the template files have the same extension. i.e. default.jade

Example:

"template": {
  "path": "./templates/",
  "file": "default",
  "lib": "jade"
}

In this example Matic will expect to find a file named default.jade located in the templates folder at the root of your project.

Assets [ ]

An array of files or folders to be copied into the target build folder. There are no resources referenced by default, you will need to add your own config.json file to the project root if you want Matic to copy additional files and/or folders during build. The original resources will remain unchanged.

Example:

{"assets": ["css", "js"]}

This example instructs Matic to copy two folders named css and js into the target build folder. Copying is done recursively which includes all files and sub folders.

Licence

MIT

matic's People

Contributors

mattyod avatar nickl- avatar

Watchers

Michael Logothetis avatar

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.