Sha256: 0182d951953d121da8e435236cf3a61879d9e91b40395c7cb5651a11088890c8

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

Jekyll::Hooks.register(:site, :post_write) do |site|
  if Jekyll.env == "production"
    raise PurgecssNotFoundError unless File.file?("./node_modules/.bin/purgecss")

    raise PurgecssRuntimeError unless system(
      "./node_modules/.bin/purgecss " \
      "--config ./purgecss.config.js " \
      "--out #{site.config.fetch("destination")}/#{site.config.fetch("css_dir", "css")}/"
    )
  end
end

class PurgecssNotFoundError < RuntimeError; end
class PurgecssRuntimeError < RuntimeError; end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-purgecss-0.2.0 lib/jekyll/hooks/purgecss.rb