README
A simple static site generator for Node
This library is in extremely early development and has no error handling
To use:
Install noisey globally ``````npm i -g noisey```
Make a new directory and navigate to it.
Run the following:
npm init
noisey init
This will create two directories - templates and pageData.
Files in pageData should export an array of objects in the following format:
pageData/test.js
const data = [
{
fileName: 'test_second', // The name of the html file to be created
directory: 'build', // The directory to build the file in
template: "test", // The name of the template html file in the templates directory
data: { // Any template variables to be passed to the template
text: 'Hello world!'
}
}
]
module.exports = data;
Data can be acquired from whatever source you want - databases, AJAX, etc. A corresponding template should exist in the templates directory.
Templates are just html files with template literals to insert variables from a pageData file.
templates/test.html:
<h1>${text}</h1>
In this case, each test.js object will create a corresponding html file with the ${text} string replaced with "Hello world!"
To perform a build of the entire site (using all of your pageData files and corresponding templates), run:
noisey build
To perform a build only of specified files, run:
noisey build dataModule1 dataModule2 etc.
In our example, to build only test.js we would run:
noisey build test