Class: Jekyll::PostCard::Generator

Inherits:
Generator
  • Object
show all
Defined in:
lib/jekyll-post-card/generator.rb

Overview

Generator that copies the post-card CSS to the site's assets

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/jekyll-post-card/generator.rb', line 26

def generate(site)
  asset_source = Jekyll::PostCard.asset_path
  css_source = File.join(asset_source, "post-card.css")

  unless File.exist?(css_source)
    Jekyll::PostCard.logger.warn("post-card.css not found at #{css_source}")
    return
  end

  # Add CSS file as a static file with custom destination
  site.static_files << CssFile.new(
    site,
    asset_source,
    "",
    "post-card.css",
    "/assets/css"
  )
end