Socket
Socket
Sign inDemoInstall

enfield

Package Overview
Dependencies
128
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    enfield

Jekyll-like blog engine for node.js


Version published
Weekly downloads
8
increased by700%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

Version 0.4.0

  • Use highlight.js if pygments is set to false
  • New config parameter for converter.convert API
  • Add support for the date_to_rfc822 filter present in Jekyll
  • Created tests and set up automated build testing with Travis: https://travis-ci.org/fortes/enfield
  • Use promises via the Q library instead of callbacks
  • Various bugfixes

Readme

Source

Build Status Dependency Status devDependency Status


Enfield

Jekyll-like static site generator for node.js that aims to be as compatible as possible with Jekyll.

Features

Core functionality is identical to Jekyll:

  • Blog aware static site generator
  • Compatible with the Jekyll directory and file structure
  • Use Markdown for posts
  • Code highlighting via Pygments or Highlight.js
  • Layouts written using Liquid template engine
  • Server / Auto-regenerate
  • Extension-less page URLs (i.e. /example/ from /example.html via pretty_urls configuration variable)

There are a few bonus features not present in the default install of Jekyll:

  • Jekyll-like plugin model, with CoffeeScript/JS instead of Ruby
  • Use Markdown within includes
  • Compile and minify CoffeeScript & LESS
  • Support post and page URL aliases via redirects

Finally, there are a few missing features:

  • Textile support
  • Importing tools

Usage

Generated directly from enfield --help

Enfield is a blog-aware static-site generator modeled after Jekyll

Commands:
  build                Build your site
  help                 Display global or [command] help documentation.
  new                  Creates a new Jekyll site scaffold in PATH
  serve                Serve your site locally

Global Options:
  -s, --source [DIR]
      Source directory (defaults to ./)

  -d, --destination [DIR]
      Destination directory (defaults to ./_site)

  --safe
      Safe mode (defaults to false)

  --plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]
      Plugins directory (defaults to ./_plugins)

  --layouts
      Layouts directory (defaults to ./_layouts)

  -h, --help
      Display help documentation

  -v, --version
      Display version information

Plugins

Enfield will load any .coffee or .js file from the _plugins directory. The plugin system is modeled after Jekyll Plugins. The following plugin types are supported:

  • Converters
  • Liquid Filters
  • Custom Tags
  • 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, config, callback) {
        // Return converted value via callback(err, content)
        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();
    }
  }
}

Custom Tags

module.exports = {
  "tags": {
    "mytag": function(body, page, site) {
      // Body is the content string within the tag
      // Page is the object of the current page being converted
      // Site is the same data structure passed to liquid templates
      // (see generators below)
      return "Hello World";
    }
  }
}

Generators

Generators are used to create additional content for your site based on custom logic.

module.exports = {
  "generators": {
    "bar": function(site, callback) {
      // Same data structure as passed to Liquid templates. Including:
      // - site.posts
      // - site.pages
      // - site.tags
      // - site.categories
      // - site.static_files

      // Make sure to callback when you're done
      callback(null);
    }
  }
}

See src/plugins/enfield-generators.coffee for examples.

TODO

  • Consider configurable permalinks
  • Post index page for year directories
  • Check for permalink collisions due to same slug and different dates

License

MIT

Contributors

Contributors

This Project Has a Stupid Name

Richard Enfield is a minor character in The Strange Case of Dr. Jekyll and Mr. Hyde.

Keywords

FAQs

Last updated on 15 Apr 2015

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc