Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Performing a build action after generation (is there a better way?) #1145

robmadole opened this Issue May 24, 2013 · 6 comments


None yet
5 participants

Hey Jekyll folks.

We're trying to integrate a build process that compiles less files into CSS.


What we came up with is to add a step into the Jekyll::Site class.

  class Site

    def process


    # Special build process, the Makefile uses `lessc <file.less> <output.css>`
    def build
      system("make build", :chdir => self.config['destination'], :out => :err)


We use Jekyll to generate the Less files themselves (looping through a list of icons). Because of this we have to wait until after the write method is called.

What we have works, but it would be great to have a more "blessed" approach to this. I was going to write a plugin to do it but couldn't figure out how to wait until after the files were written.

Is there a better way?

For example, if I could write a plugin and do this it would fill me with joy:

def build()
    # Do build stuff here


@robmadole robmadole closed this May 24, 2013

Whoops click happy

@robmadole robmadole reopened this May 24, 2013


parkr commented May 24, 2013

Heyo! This is a splendid idea. The extra code would behave as normal plugins and not be executed on GitHub Pages, but there is no reason we should force anyone to monkey-patch Site#process to implement a build feature.

I'd love to get the thoughts of the venerable @mattr-, @benbalter, and @dhcole.


mattr- commented May 25, 2013

I'm cool with this. I was just reading about hook methods in Sandi Metz's POODR book and was thinking something like this would be useful


parkr commented Jun 4, 2013

How would you envision it? Should plugins have access directly or should plugin authors have to monkey-patch a method intentionally left blank? It would cool if plugins could just hand us procs or something:

Jekyll.after_build do
  system("make build")

We should also come up with a way for plugins in a gemfile to be picked up rather than requiring that something be placed in plugins/.


holic commented Jul 30, 2013

👍 for something like Jekyll.after_build


parkr commented Jul 31, 2014

Jekyll 3.0 is entirely hook-based, so this will work once that's finished.

@parkr parkr closed this Jul 31, 2014

@jekyllbot jekyllbot locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.