You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
webpack-plugin/README.md

132 lines
2.5 KiB

# Site-O-Mat Webpack Plugin
1 year ago
A Webpack Plugin for generating a Website as Html-Files from a Markdown File Structure.
1 year ago
1 year ago
Why? The Main reason i had to update some Websites, but realise there were no benfit
to use a Full CMS or Headless CMS like Directus. Rendering the same pages that a rarley updated
seems like a waste of energy. Why not generate from a hierachical file structure. Luckly i
i had development a CMS that runs on Markdown File a few years ago as a proof of concept.
1 year ago
## Roadmap
Next will be,
* Some tests
1 year ago
* Better Filtering in Queries
Maybe later,
1 year ago
* Integrate Eta.js and LiquidJS
1 year ago
## Installation
1 year ago
Setup this registry in your project .npmrc file:
```
@helpers:registry=https://gitea.node001.net/api/packages/HerrHase/npm/
```
Install with npm or yarn
1 year ago
```
1 year ago
npm i --save-dev @helpers/siteomat-webpack-plugin
yarn add --dev @helpers/siteomat-webpack-plugin
1 year ago
```
## Configuration
```
const SiteomatWebpackPlugin = require('siteomat-webpack-plugin')
1 year ago
plugins: [
new SiteomatWebpackPlugin(
1 year ago
'./resources/site',
'./resources/views'
)
]
1 year ago
```
1 year ago
or
```
plugins: [
new SiteomatWebpackPlugin(
'./resources/site',
'./resources/views',
{
<options>
}
)
]
```
1 year ago
| Name | Type | Default | Description |
|-------------|-----------|---------|-------------|
| destination | {String} | null | If not set, it will use the public path |
| htmlMinify | {Boolean} | true | Minify Html and remove all Whitespace |
## Pages
1 year ago
1 year ago
Pages are Markdown-Files, they are seperates in two parts. First part is a yaml-Section,
1 year ago
```
---
title: "health goth DIY tattooed"
view: "home.njk"
meta:
description: "La"
media:
teaser:
src: "_images/test.jpeg"
alt: "cold-pressed"
---
```
1 year ago
These yaml will be parsed as a Object and available in Templates. "view" is required. Second
part will be parsed as Markdown, but could be empty.
## Nesting
```
index.md
1 year ago
about-me.md
1 year ago
blog
1 year ago
└ index.md
1 year ago
belly-polaroid-subway.md
```
will be
```
index.html
about-me.html
blog.html
blog/belly-polaroid-subway.html
1 year ago
```
## Blocks
1 year ago
1 year ago
"_blocks" in a Directory,
## Queries
### Pages
1 year ago
Basic Usage:
```
pageQuery.find()
```
or with options,
| Name | Type | Default | Description |
|-------------|-----------|---------|-------------|
1 year ago
| parent | {String} | / | Directory for start query |
| deep | {Integer} | -1 | Deep of Recursive |
| orderBy | {Array} | null | Name of field sorting, a "-" in front of the. Nested fields are also possible. |
1 year ago