vivliostyle/vivliostyle-cli

EPUBとwebpub出力でTheme内のサンプルの画像など不要なファイルが入る

MurakamiShinyu opened this issue · 0 comments

Vivliostyle CLIでthemeを利用してEPUBやwebpub出力を行った場合、themeに含まれるサンプルの画像など不要なファイルが入ってしまう問題があります。

再現テスト

以下、テストした例:

テスト1:コマンドラインでthemeを指定してEPUB出力を行う例

themeとして @vivliostyle/theme-epub3j を指定してEPUB出力を行った例:

$ vivliostyle build --theme @vivliostyle/theme-epub3j TEST.md -o output.epub
⊙ Installing theme files
output.epub has been created.
🎉 Built successfully.

$ zipinfo -1 output.epub
mimetype
META-INF/container.xml
EPUB/TEST.xhtml
EPUB/content.opf
EPUB/publication.json
EPUB/themes/
EPUB/themes/packages/
EPUB/themes/packages/@vivliostyle/
EPUB/themes/packages/@vivliostyle/theme-epub3j/
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/book-style.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/style-advance.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/style-check.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/style-reset.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/style-standard.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/cover.jpg
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/gaiji-min-u8fe6.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/headmark.gif
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/img-001.jpg
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/img-002.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/img-003.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/img-004.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/logo-bunko.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/theme.css
EPUB/toc.ncx

この結果を見ると、出力されたEPUBに不要なファイル(theme に含まれる example 内の画像ファイル類)が入っている。

テスト2:コマンドラインでthemeを指定してwebpub出力を行う例

themeとして @vivliostyle/theme-base を指定してwebput出力を行った例:

$ vivliostyle build --theme @vivliostyle/theme-base TEST.md -o webpub/
◡ Installing theme files
webpub has been created.
🎉 Built successfully.

$ tree webpub/
webpub/
├── TEST.html
├── publication.json
└── themes
    └── packages
        └── @vivliostyle
            └── theme-base
                ├── css
                │   ├── common
                │   │   ├── basic.css
                │   │   ├── meta-properties.css
                │   │   └── reset.css
                │   ├── lib
                │   │   └── prism
                │   │       ├── base.css
                │   │       ├── theme-okaidia.css
                │   │       └── theme-prism.css
                │   └── partial
                │       ├── crossref.css
                │       ├── endnote.css
                │       ├── footnote-external-link.css
                │       ├── footnote.css
                │       ├── page.css
                │       ├── section.css
                │       ├── toc.css
                │       └── utility-classes.css
                ├── example
                │   ├── 2.html
                │   ├── 3.html
                │   ├── assets
                │   │   └── Logo\ (Mark\ +\ Type).png
                │   └── default.html
                ├── theme-all.css
                └── theme-basic.css

11 directories, 22 files

この結果を見ると、出力されたwebpubディレクトリ内に不要なファイル(theme に含まれる example 内の画像ファイルやHTMLファイル)が入っている。

テスト3:Create Bookを利用してconfigを作ってEPUB出力を行う例

$ npm create book test4epub
? Description test4epub
? Author name MurakamiShinyu
? Author email murakami@vivliostyle.org
? License CC0-1.0
? choose theme @vivliostyle/theme-epub3j - EPUB3 (Japanese) 日本語EPUB用テーマ(電書協EPUB3制作ガイド準拠)

Creating a new package in /Users/……/test4epub.
……

$ cd test4epub/

vivliostyle.config.js を編集して output の指定を次のようにする:

  output: [
    './output.epub',
  ],

これで build を実行し、生成されたEPUBを見てみる:

$ npm run build

> test-4epub@0.0.0 build
> vivliostyle build

⚠ No table of contents document was found. for EPUB output, we recommend to enable `toc` option in your Vivliostyle config file to generate a table of contents document.
⊙ Installing theme files
output.epub has been created.
🎉 Built successfully.

$ zipinfo -1 output.epub
mimetype
META-INF/container.xml
EPUB/content.opf
EPUB/manuscript.xhtml
EPUB/node_modules/
EPUB/node_modules/@vivliostyle/
EPUB/node_modules/@vivliostyle/viewer/
EPUB/node_modules/@vivliostyle/viewer/docs/
EPUB/node_modules/@vivliostyle/viewer/docs/index.xhtml
EPUB/node_modules/@vivliostyle/viewer/lib/
EPUB/node_modules/@vivliostyle/viewer/lib/css/
EPUB/node_modules/@vivliostyle/viewer/lib/css/ui.arrows.css
EPUB/node_modules/@vivliostyle/viewer/lib/css/ui.loading-overlay.css
EPUB/node_modules/@vivliostyle/viewer/lib/css/ui.menu-bar.css
EPUB/node_modules/@vivliostyle/viewer/lib/css/ui.message-dialog.css
EPUB/node_modules/@vivliostyle/viewer/lib/css/ui.text-selection-menu.css
EPUB/node_modules/@vivliostyle/viewer/lib/css/vivliostyle-viewer.css
EPUB/node_modules/@vivliostyle/viewer/lib/index.xhtml
EPUB/node_modules/i18next-ko/
EPUB/node_modules/i18next-ko/example/
EPUB/node_modules/i18next-ko/example/example.xhtml
EPUB/node_modules/playwright-core/
EPUB/node_modules/playwright-core/lib/
EPUB/node_modules/playwright-core/lib/vite/
EPUB/node_modules/playwright-core/lib/vite/htmlReport/
EPUB/node_modules/playwright-core/lib/vite/htmlReport/index.xhtml
EPUB/node_modules/playwright-core/lib/vite/recorder/
EPUB/node_modules/playwright-core/lib/vite/recorder/assets/
EPUB/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-5d0f417c.css
EPUB/node_modules/playwright-core/lib/vite/recorder/assets/index-a8ba096a.css
EPUB/node_modules/playwright-core/lib/vite/recorder/index.xhtml
EPUB/node_modules/playwright-core/lib/vite/traceViewer/
EPUB/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.5d0f417c.css
EPUB/node_modules/playwright-core/lib/vite/traceViewer/index.a60f70ab.css
EPUB/node_modules/playwright-core/lib/vite/traceViewer/index.xhtml
EPUB/node_modules/playwright-core/lib/vite/traceViewer/snapshot.xhtml
EPUB/node_modules/playwright-core/lib/vite/traceViewer/uiMode.41e90341.css
EPUB/node_modules/playwright-core/lib/vite/traceViewer/uiMode.xhtml
EPUB/node_modules/playwright-core/lib/vite/traceViewer/wsPort.dd1cbe2e.css
EPUB/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.6428296b.css
EPUB/node_modules/prismjs/
EPUB/node_modules/prismjs/plugins/
EPUB/node_modules/prismjs/plugins/autolinker/
EPUB/node_modules/prismjs/plugins/autolinker/prism-autolinker.css
EPUB/node_modules/prismjs/plugins/autolinker/prism-autolinker.min.css
EPUB/node_modules/prismjs/plugins/command-line/
EPUB/node_modules/prismjs/plugins/command-line/prism-command-line.css
EPUB/node_modules/prismjs/plugins/command-line/prism-command-line.min.css
EPUB/node_modules/prismjs/plugins/diff-highlight/
EPUB/node_modules/prismjs/plugins/diff-highlight/prism-diff-highlight.css
EPUB/node_modules/prismjs/plugins/diff-highlight/prism-diff-highlight.min.css
EPUB/node_modules/prismjs/plugins/inline-color/
EPUB/node_modules/prismjs/plugins/inline-color/prism-inline-color.css
EPUB/node_modules/prismjs/plugins/inline-color/prism-inline-color.min.css
EPUB/node_modules/prismjs/plugins/line-highlight/
EPUB/node_modules/prismjs/plugins/line-highlight/prism-line-highlight.css
EPUB/node_modules/prismjs/plugins/line-highlight/prism-line-highlight.min.css
EPUB/node_modules/prismjs/plugins/line-numbers/
EPUB/node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css
EPUB/node_modules/prismjs/plugins/line-numbers/prism-line-numbers.min.css
EPUB/node_modules/prismjs/plugins/match-braces/
EPUB/node_modules/prismjs/plugins/match-braces/prism-match-braces.css
EPUB/node_modules/prismjs/plugins/match-braces/prism-match-braces.min.css
EPUB/node_modules/prismjs/plugins/previewers/
EPUB/node_modules/prismjs/plugins/previewers/prism-previewers.css
EPUB/node_modules/prismjs/plugins/previewers/prism-previewers.min.css
EPUB/node_modules/prismjs/plugins/show-invisibles/
EPUB/node_modules/prismjs/plugins/show-invisibles/prism-show-invisibles.css
EPUB/node_modules/prismjs/plugins/show-invisibles/prism-show-invisibles.min.css
EPUB/node_modules/prismjs/plugins/toolbar/
EPUB/node_modules/prismjs/plugins/toolbar/prism-toolbar.css
EPUB/node_modules/prismjs/plugins/toolbar/prism-toolbar.min.css
EPUB/node_modules/prismjs/plugins/treeview/
EPUB/node_modules/prismjs/plugins/treeview/prism-treeview.css
EPUB/node_modules/prismjs/plugins/treeview/prism-treeview.min.css
EPUB/node_modules/prismjs/plugins/unescaped-markup/
EPUB/node_modules/prismjs/plugins/unescaped-markup/prism-unescaped-markup.css
EPUB/node_modules/prismjs/plugins/unescaped-markup/prism-unescaped-markup.min.css
EPUB/node_modules/prismjs/plugins/wpd/
EPUB/node_modules/prismjs/plugins/wpd/prism-wpd.css
EPUB/node_modules/prismjs/plugins/wpd/prism-wpd.min.css
EPUB/node_modules/prismjs/themes/
EPUB/node_modules/prismjs/themes/prism-coy.css
EPUB/node_modules/prismjs/themes/prism-coy.min.css
EPUB/node_modules/prismjs/themes/prism-dark.css
EPUB/node_modules/prismjs/themes/prism-dark.min.css
EPUB/node_modules/prismjs/themes/prism-funky.css
EPUB/node_modules/prismjs/themes/prism-funky.min.css
EPUB/node_modules/prismjs/themes/prism-okaidia.css
EPUB/node_modules/prismjs/themes/prism-okaidia.min.css
EPUB/node_modules/prismjs/themes/prism-solarizedlight.css
EPUB/node_modules/prismjs/themes/prism-solarizedlight.min.css
EPUB/node_modules/prismjs/themes/prism-tomorrow.css
EPUB/node_modules/prismjs/themes/prism-tomorrow.min.css
EPUB/node_modules/prismjs/themes/prism-twilight.css
EPUB/node_modules/prismjs/themes/prism-twilight.min.css
EPUB/node_modules/prismjs/themes/prism.css
EPUB/node_modules/prismjs/themes/prism.min.css
EPUB/node_modules/tslib/
EPUB/node_modules/tslib/tslib.es6.xhtml
EPUB/node_modules/tslib/tslib.xhtml
EPUB/publication.json
EPUB/themes/
EPUB/themes/packages/
EPUB/themes/packages/@vivliostyle/
EPUB/themes/packages/@vivliostyle/theme-epub3j/
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/book-style.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/style-advance.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/style-check.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/style-reset.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/ebpaj_epub3guide/style-standard.css
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/cover.jpg
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/gaiji-min-u8fe6.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/headmark.gif
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/img-001.jpg
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/img-002.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/img-003.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/img-004.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/example/assets/logo-bunko.png
EPUB/themes/packages/@vivliostyle/theme-epub3j/theme.css
EPUB/toc.ncx

この結果を見ると、出力されたEPUBに不要なファイルが大量に入っている。