skoji/gepub

include assets (css)

Closed this issue · 0 comments

I want to include custom css and images. I've tried using GEPUB::Book and including it in the item directly:

book.add_item('text/first_page.xhtml', content: StringIO.new(<<-FIRST_PAGE))
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?xml-stylesheet href="../../../public/css/first.css" type="text/css"?>
</head>
...
FIRST_PAGE

I include the image by adding the item:

File.open(File.expand_path('../../../public/images/logo.png', File.dirname(__FILE__))) do |io|
    book.add_item("images/logo.png", io)
end

I've also tried using GEPUB::Builder :

resources(:workdir => File.dirname(__FILE__)) do
    glob '../../../public/css/*.css'
    file 'images/logo.png' => '../../../public/images/logo.png'
    ...
end

I don't see the css or image included in the final epubs. What is the correct way to do this?