https://github.com/penge/maren-build
Maren module that produces the build into the _build directory.
https://github.com/penge/maren-build
build maren npm-package
Last synced: 4 months ago
JSON representation
Maren module that produces the build into the _build directory.
- Host: GitHub
- URL: https://github.com/penge/maren-build
- Owner: penge
- Created: 2019-10-25T06:36:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T23:24:38.000Z (over 3 years ago)
- Last Synced: 2025-06-04T17:19:05.091Z (about 1 year ago)
- Topics: build, maren, npm-package
- Language: JavaScript
- Homepage: https://maren.io
- Size: 214 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Maren Build
## API
```js
const {
build,
buildFile,
buildFilePath
} = require('maren-build');
```
### build
```js
/**
* Build blog in and put files in /_build
*
* @param cwd - Absolute path to the blog
*
* @param rawTheme - Theme that will have its styles and scripts hashed
* @param rawTheme.name - Theme name (ie. "brown")
* @param rawTheme.location - Absolute path to the theme
* @param rawTheme.template - (data) => html
* @param rawTheme.options
* @param rawTheme.options.styles - ['brown-styles.min.css']
* @param rawTheme.options.scripts - ['brown-scripts.min.js']
*
* @param renderFunction - (markdownString, theme) => html;
*
* @return { theme, pathsToWatch }
* @return theme - Same as rawTheme with styles and scripts being hashed
* @return theme.name
* @return theme.location
* @return theme.template
* @return theme.options
* @return theme.options.styles - ['/themes/brown/brown-styles-8a1...5ee.css']
* @return theme.options.scripts - ['/themes/brown/brown-scripts-3c2...82a.js']
* @return pathsToWatch - Glob paths to md files in "documents" and "draft"
*/
const {
theme,
pathsToWatch
} = await build(cwd, rawTheme, renderFunction);
```
### buildFile
```js
/**
* Read Markdown file at "src",
* use "theme" and "renderFunction" to render it to html,
* and save html to "dest".
*/
const success = await buildFile(src, dest, theme, renderFunction);
```
### buildFilePath
```js
/**
* Return absolute html path.
*/
const dest = buildFilePath(cwd, mdPath);
```
## Tests
```
npm test
```