dave-sitegen
v2.16.1
Published
Sitegen is a dead simple static site generator, using React. It does one thing:
Downloads
7
Readme
sitegen(1)
Sitegen is a dead simple static site generator, using React. It does one thing:
- Take
.html.jsx
files and spit out.html
files. That's it
But, you can customize it a bit, and there are a couple built in components.
Why
I wanted a simple thing to make my personal website (davecode.me), so I made it myself. No fancy build settings, giant build times, huge libraries bundled in. With sitegen, what is thrown in is thrown out.
Install
$ npm install dave-sitegen
Usage
sitegen
- Runs sitegen on the current folder.sitegen file.html.jsx
- Runs sitegen on onlyfile.html.jsx
.sitegen -w
- Runs sitegen in watch mode.sitegen -p
- Preview the outputfile.html.jsx
sitegen -d
- Develop Mode
Components
built in
import Sitegen from 'sitegen';
// or
import { version, Title } from 'sitegen';
- version - library version.
- useCurrentFile - returns the current file.
- useScriptTag - lets you embed client-side javascript and take in variables from the build step, js is minified.
- useRawScriptTag - appends a raw script to the document
- useId - returns a random string.
- Title - set the document title, shorthand for
react-helmet
- StyleInjector - adds inline css, and minifies it. OR extracts the css to a hash based filename and adds a lazy load script.
- Raw - include raw html.
- createSSRPortal - replacement for React DOM Portals.
- useController - weird thing, lets you add "singleton" components.
- IGNORE - Add
Sitegen.IGNORE
to ignore running this file. - root - Relative Path to Root.
- hook - raw hook data.
- addDependency - add a depending file (should not be needed as this is auto done)
- removeDependency - remove a depending file (should not be needed as this is auto done)
- addShallowDependency - changing the file directly causes update, but recursion chains are not allowed. used to help make the DSVFooter
davecode.me components
Only available when developing the text content for davecode.me.
import Tooltip from 'components/Tooltip';
- AccessDenied - creates a https://davecode.me/access-denied
- Block - blocked out / censored
- Color - Color, uses a context.
- InlineStyles - a themable css template by passing in some colors
- LongDash - The "—" Symbol
- Meta - Meta Tags
- ModifyCharacters - DSV: Character Style Overrides
- SubHeader - A sub header, for page dates
- TerminalCommands - Some Terminal Commands
- Tooltip - the hover tooltips
- WarningHeader - Big red warning box.