-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8f16dd2
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# `generator-hello-world` | ||
|
||
This is a basic example of a `generator` in the static Application Design Approach. A `generator` (static site generator) processes a `static.json` file and produces a static web page or dynamic web application. | ||
|
||
By referencing this `generator` in a `static.json` file and providing a `data.message` value, the `generator` will produce a static web page with the provided `data.message`. | ||
|
||
A template repository that references this generator can be found at: https://github.com/from-static/template-hello-world. | ||
|
||
This template repository can be used to create custom distributions of the generator on GitHub Pages by only modifying the `data.message` value in the `static.json` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const fs = require('fs'); | ||
|
||
console.log('@from-static/generator-hello-world: Configuring "out" directory.') | ||
fs.rmSync('./out', { recursive: true }); | ||
fs.mkdirSync('./out'); | ||
|
||
let _STATIC = {}; | ||
|
||
try { | ||
console.log('@from-static/generator-hello-world: Reading "static.json" file.') | ||
_STATIC = require('./static.json'); | ||
} catch (e) { | ||
console.log('@from-static/generator-hello-world: Error reading "static.json" file.'); | ||
} | ||
|
||
fs.writeFileSync('./out/index.html', _STATIC?.data?.message || ''); | ||
|
||
console.log('@from-static/generator-hello-world: Done!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@from-static/generator-hello-world", | ||
"version": "1.0.0", | ||
"description": "An example generator for use in the static Application Design Approach", | ||
"scripts": { | ||
"build": "node index.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/from-static/generator-hello-world.git" | ||
}, | ||
"author": "Joe Bottigliero", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/from-static/generator-hello-world/issues" | ||
}, | ||
"homepage": "https://github.com/from-static/generator-hello-world#readme" | ||
} |