maren-build

0.2.0 • Public • Published

Maren Build

API

const {
  build,
  buildFile,
  buildFilePath 
= require('maren-build');

build

/**
 * Build blog in <cwd> and put files in <cwd>/_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

/**
 * 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

/**
 * Return absolute html path.
 */
const dest = buildFilePath(cwd, mdPath);

Tests

npm test

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    1
  • 0.1.1
    1
  • 0.1.0
    1

Package Sidebar

Install

npm i maren-build

Homepage

maren.io

Weekly Downloads

3

Version

0.2.0

License

MIT

Unpacked Size

16.9 kB

Total Files

63

Last publish

Collaborators

  • penge