As of version 2.5.0
, Jekyll can be extended with plugins which provide
subcommands for the jekyll executable. This is possible by including the
relevant plugins in a Gemfile group called :jekyll_plugins:
Each Command must be a subclass of the Jekyll::Command class and must
contain one class method: init_with_program. An example:
classMyNewCommand<Jekyll::Commandclass<<selfdefinit_with_program(prog)prog.command(:new)do|c|c.syntax"new [options]"c.description'Create a new Jekyll site.'c.option'dest','-d DEST','Where the site should go.'c.actiondo|args,options|Jekyll::Site.new_site_at(options['dest'])endendendendend
Commands should implement this single class method:
Method
Description
init_with_program
This method accepts one parameter, the
Mercenary::Program
instance, which is the Jekyll program itself. Upon the program,
commands may be created using the above syntax. For more details,
visit the Mercenary repository on GitHub.com.