Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
bake is a small tool that is able to read a directory tree of Markdown files and turns them into a website. Other files are kept as they are. This way you can mix up Markdown files with individual HTML pages.
It also allows defining templates for the Markdown files, that are automatically applied.
Using this package is quite easy. Install it with npm.
$ npm install -g bake
Then use the following code to "bake" your website
var bake = require("bake");
bake("/path/to/website");
The directory structure at /path/to/website
should be like in the bake
boilerplate. You may fork it to quickly setup
your site. It also serves as a usage example.
This package is intended to be used as a post-receive hook for a GIT repository, that turns the contents of the repository into a website. This way it can be used as a CMS. But you don't have to use it like that. It also runs independent of GIT.
The content of your pages is defined in Markdown files in the folder pub
. You
also may define additional properties at the top of each document. Here is an
example for a typical blog post:
title: First post
date: August, 14th 2011
author: Paul
template: post
This is my **first** blog post.
Here's a heading
----------------
> And this is a block quote
This could be the content of the file pub/first-post.mkd
. Every file that ends
with .mkd
, .md
or .markdown
is recognized as a Markdown file.
As you can see it defines a template
. Bake then looks for the file
tpl/post.tpl
. This may be an HTML file.
A very basic version of this post.tpl
would look like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{title} » {websiteTitle}</title>
</head>
<body>
<h1>{title}</h1>
<p>Written on {date} by {author}</p>
{__content}
</body>
</html>
This will result in the HTML file pub/first-post.html
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>First post » {websiteTitle}</title>
</head>
<body>
<h1>First post</h1>
<p>Written on August, 14th 2011 by Paul</p>
<p>This is my <strong>first</strong> blog post.</p>
<h2>Here's a heading</h2>
<blockquote>And this is a block quote</blockquote>
</body>
</html>
As you can see {websiteTitle}
is not replaced. Because this property stays the
same for the whole site, you can define it in conf/bake.json
:
{
"defaultTemplate": "post",
"defaultAuthor": "Paul",
"properties": {
"websiteTitle": "Paul's Weblog"
}
}
Bake won't run, if this file doesn't exist.
Bake is no webserver. It doesn't replace your Apache/Nginx. So if you want your
website to be accessible to the public, you have to change the settings of your
webserver to use pub/
as the root directory.
Bake is no blogging engine. It doesn't provide generating an index or a feed. It doesn't have any commenting functionality.
If you encounter any bugs or issues, feel free to open an issue at github.
This package is licensed under the MIT license.
This work was inspired by heimweh by ben_ and txtracer by konnexus, but also by wheat by creationix.
FAQs
static file bakery
We found that bake demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.