Enfield
Jekyll-like static site generator for node.js that aims to be as compatible as possible with mojombo/jekyll.
Features
- Compatible with the Jeykll directory and file structure
- Simple, Jekyll-like plugin model, with CoffeeScript/JS instead of Ruby
- Server / Auto-regenrate
- Compile and minify CoffeeScript & LESS
Usage
Generated directly from enfield --help
Enfield is a static-site generator modeled after Jekyll
Usage:
enfield # Generate . -> ./_site
enfield [destination] # Generate . -> <path>
enfield [source] [destination] # Generate <path> -> <path>
enfield init [directory] # Build default directory structure
enfield page [title] # Create a new post with today's date
enfield post [title] # Create a new page
Options:
--auto Auto-regenerate
--server [PORT] Start a web server (default port 4000)
--url [URL] Set custom site.url
Plugins
Enfield will load any .coffee
or .js
file from the _plugins
directory. The plugin system is modeled after Jekyll Plugins. However, the following plugin types are supported:
- Converters
- Liquid Filters
- Generators
Converters
Custom converters can be added. Note that only items with YAML frontmatter will be converted. All others are ignored.
module.exports = {
"converters": {
"foo": {
"priority": 1,
"matches": function(ext) {
return ext === '.foo';
},
"outputExtension": function(ext) {
return ".html";
},
"convert": function(content, callback) {
callback(null, content.replace('foo', ''));
}
}
}
}
Valid priority values: 1 (lowest) - 5 (highest)
Liquid Filters
Custom Liquid Filters can be added:
module.exports = {
"filters": {
"upcase": function(val) {
return val.toUpperCase();
},
"lowercase": function(val) {
return val.toLowerCase();
}
}
}
Generators
Generators are used to create additional content for your site based on custom logic.
module.exports = {
"generators": {
"bar": function(site, callback) {
callback(null);
}
}
}
See src/plugins/enfield-generators.coffee
for examples.
Changelog
Version 0.2.0
- Change generator and convert plugin APIs to be async
- Compile and minify LESS.css via bundled plugin
Version 0.1.1
- Add support for generator plugins.
- Compile and minify CoffeeScript via bundled plugin
Version 0.1.0
TODO
- Support some form of post pagination
- site_url option
- Consider configurable permalinks
- Post index page for year directories
- Proper include support (nesting)
- Check for permalink collisions due to same slug and different dates
This Project Has a Stupid Name
Richard Enfield is a minor character in The Strange Case of Dr. Jekyll and Mr. Hyde.