A CMS based on atomic design principles.
npm install frixhtml-content and json-content exist.
html-content is called everytime the inner HTML of an element is set.
json-content is called for every entry in all content files.
key.json to choose a URL with which a template and JSON file are associated like this:
js
{
"/index": {
"template": "index.html"
"content": "main.json"
}
}
`
This serves our index.html with inserted content and resolved organisms - so, valid HTML. The templates get resolved when the Node.js server starts, so theres practically no overhead when serving files during runtime.
Example Usage
#### Server Code
`js
const express = require('express');
const Frix = require('frix');
let frix = new Frix();
let app = express();
app.use(frix.requestHandler);
`
Note that the class Frix takes an optional config as first argument which describes where all dependencies like the key.json, templates, content etc. are stored.
#### File System
See the example files at /test/files.
Installation
$ npm install frix
API Reference
#### new Frix([opts])
- opts Object a config to be merged with the default one:
`js
{
key: 'key.json',
folders: {
organism: 'templates/organisms',
molecule: 'templates/molecules',
atom: 'templates/atoms'
},
content: 'content',
pages: 'templates/pages',
attributes: {
name: 'name',
type: 'type',
content: 'content'
}
`
Returns a new instance of Frix.
#### frix.addModule(target, module)
- target String the target module(see Modules)
- module Function a function to add to the modules Array for the target. The modules array is executed in chronological order.
#### frix.addModule({ target, module })
- target String the target module(see Modules)
- module Function a function to add to the modules Array for the target. The modules array is executed in chronological order.
#### frix.isDone(onLoad)
- onLoad Function` a function to be executed when Frix has finished resolving all templates and inserting content.