igr
igr

Reputation: 10604

How to invoke my code before/after the site compilation in nanoc?

I have some additional processing, and would like to generate some javascript files based on existing content.

Therefore, I need my code to be called after the site compilation and generation, so I can create new files in the output.

How to do that in nanoc? Thank you!

Upvotes: 1

Views: 40

Answers (1)

Connor Shea
Connor Shea

Reputation: 870

You can use Ruby code in Rules with the postprocess method:

postprocess do
  items.each do |item|
    if item.identifier.to_s.end_with?(".js")
      # Do stuff
    end 
  end
end

Upvotes: 0

Related Questions