Velcro
Velcro is a simple, flat-file, blogging platform. It uses Markdown and Jade.
Installation
npm install velcro
Usage
Options:
-h, --help
output usage information
-V, --version
output the version number
Commands:
velcro create [folder]
Creates a new blog. If the destination folder does not exists it will be created. If no folder is passed, it will use the current directory (as long as it's empty).
velcro compile
Compiles all files to /public
velcro watch
Watches for changes in files inside the themes
or posts
folders, and re-compiles all the posts and .html files.
Configuration
The most basic configuration of it's stored in velcro.json
{
"name":"Velcro",
"description":"A simple blogging platform built in node.js",
"author":"Bruno Lazzaro",
"index_post_count": 5,
"theme":"default",
"date_format":"mm/dd HH:mm"
}
Also, each theme comes with it's own config.json
file.
The most important ones are the index post count and the date_format. For valid date formats check this page.
Themes
When you do velcro create
the default theme is created in the themes folder. But if you want to start from scratch only these files are needed:
- index.jade (The index template)
- archive.jade (The Archive template)
- post.jade (Individual post template)
- config.json (Theme specific configuration, can be empty but not non-existent).
You can also copy the default theme on the themes
folder. To change your theme, just change the value in the configuration file (velcro.json) to match the foldername inside of the themes
folder.
After compilation, all your theme files are copied to the public folder.
Templates
Velcro exposes certain base properties to jade along with all the post data and markdown metadata.
Main Properties:
velcro.description
(blog description, stored in velcro.json) -p= velcro.description
velcro.name
(blog name, stored in velcro.json) -h1 #{velcro.name}
- All of the
velcro.json
properties. theme
, all of the properties of config.json -h2 #{theme.fancy_variable}
Post Data
post.author
(if none is defined in the markdown metadata, then it uses the one from the velcro.json file)post.extract
(The first paragraph of the post, if it's not defined then it will be generated for you)post.date
(A string representing the time of last modification of the post, wich is usually when it was created)post.url
(only on archive and index templates)post.tags
(An array of tags, only if they were specified in a comma separated list on the markdown metadata)
Markdown Metadata
You also get all your markdown metadata inside the post object, for example if you do (in your markdown file):
pi: 3.14
cat: fluffy
Then on your template you'd be able to do:
My cat is #{post.cat} and Pi is #{post.pi}
Why velcro?
So when you use it people be like, "oh, he got the velcro".
:shipit: