Class: Abqari::BundleAssets

Inherits:
Object
  • Object
show all
Defined in:
lib/abqari/bundle_assets.rb

Overview

Copies colocated assets into the rendered output. Two flavours:

  1. Bundle-style collections (bundle: true) — each item is its own directory containing index.md plus assets. Assets are copied next to the rendered HTML:

    content/posts/2026-05-07-foo/hero.jpg
     _site/posts/foo/hero.jpg
    
    content/photos/2026-03-01-bread-shop/photo.svg
     _site/photos/bread-shop/photo.svg
    
  2. Flat collections (bundle: false) — items are single .md files; non-.md siblings (covers, PDFs, sample images) are copied into the collection's root output dir:

    content/<collection>/cover.svg
    → _site/<collection>/cover.svg
    

The page itself rewrites relative / URLs in its rendered HTML so authors can reference assets by short relative names; absolute paths in front matter (/photos/bread-shop/photo.svg) work directly.

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ BundleAssets

Returns a new instance of BundleAssets.



29
30
31
# File 'lib/abqari/bundle_assets.rb', line 29

def initialize(site)
  @site = site
end

Instance Method Details

#copyObject



33
34
35
36
# File 'lib/abqari/bundle_assets.rb', line 33

def copy
  copy_bundle_assets
  copy_flat_collection_assets
end