Comparing version 0.2.1 to 0.3.0
{ | ||
"name": "mumimal", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Mumimal is a mumi minimal blog generator.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# Mumimal | ||
Mumi and minimal blog engine. | ||
[![CircleCI](https://circleci.com/gh/wabilin/mumimal.svg?style=shield)](https://circleci.com/gh/wabilin/mumimal) | ||
> Mumi and minimal blog engine. | ||
Thin, fast and extendable. | ||
## Install | ||
@@ -15,4 +19,15 @@ ```sh | ||
## Usage | ||
Run `mumimal` or `mumimal --config config.js` | ||
### Use command | ||
`mumimal` or `mumimal --config config.js` | ||
### Use module | ||
```js | ||
const { mumimal } = require('mumimal'); | ||
const config = { | ||
//... | ||
} | ||
mumimal(config).then(...) | ||
``` | ||
Your project structure should look like | ||
@@ -30,4 +45,6 @@ ``` | ||
``` | ||
All files inside `static` would be copy to `dist` | ||
- All files inside `static` would be copy to `dist`. | ||
- Mumimal builds: index, posts, rss and sitemap. | ||
### Index | ||
@@ -54,2 +71,7 @@ When rendering index, there are: `site` (site config) and | ||
To read post content when building index: | ||
```ejs | ||
<% const { content } = funcs.readPostSrc(post.postName) %> | ||
``` | ||
### Post | ||
@@ -68,2 +90,3 @@ When rendering index, there are: | ||
<body> | ||
<div class="tags"><%= meta.tags.join(', ') %></dib> | ||
<article> | ||
@@ -85,4 +108,4 @@ <%- content %> | ||
### Config | ||
Use `mumimal --config config.js` to apply custom config | ||
### Configuration | ||
Use `mumimal --config config.js` to apply custom config. | ||
@@ -101,3 +124,10 @@ ```js | ||
categories: ["Tech", "Node.js"] | ||
}, | ||
build: { | ||
minify: true, | ||
minifyOptions: {}, | ||
} | ||
afterBuild: (context) => { | ||
console.log(context) | ||
} | ||
} | ||
@@ -115,4 +145,1 @@ module.exports = { config } | ||
But in Taiwan, we all call her Mumi. | ||
## TODO | ||
- [ ] get posts content in index |
// @ts-check | ||
const ejs = require('ejs'); | ||
const { minify } = require('html-minifier-terser'); | ||
const { readPostSrc } = require('./parsePosts'); | ||
const { minify } = require('html-minifier-terser'); | ||
const { INDEX_LAYOUT_PATH, DIST_INDEX_PATH } = require('./paths'); | ||
@@ -17,2 +18,5 @@ const { writeFile } = require('./file'); | ||
posts, | ||
funcs: { | ||
readPostSrc, | ||
}, | ||
}; | ||
@@ -19,0 +23,0 @@ |
@@ -63,2 +63,3 @@ // @ts-check | ||
* @property {Object} [build] | ||
* @property {(context: Context) => Promise<void>} [afterBuild] | ||
*/ | ||
@@ -125,3 +126,8 @@ | ||
return createSitemap(context); | ||
await createSitemap(context); | ||
const { afterBuild } = config; | ||
if (typeof afterBuild === 'function') { | ||
await afterBuild(context); | ||
} | ||
} | ||
@@ -128,0 +134,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17367
552
139