kohheepeace / docusaurus-pdf

Generate PDF for docusaurus
https://drive.google.com/file/d/19P3qSwLLUHYigrxH3QXIMXmRpTFi4pKB/view
113 stars 18 forks source link

[Todo] Add document to show how to generate PDF during build with Netlify #9

Open kohheepeace opened 4 years ago

kohheepeace commented 4 years ago

Add document in README.

Ref: https://github.com/KohheePeace/docusaurus-pdf/pull/7#issuecomment-619364873

kohheepeace commented 4 years ago

[My flow of using docusaurus]

  1. Edit document
  2. commit and push the changes to github
  3. Netlify automatically run yarn build command written in package.json

So, in my package.json

"scripts": {
    "start": "docusaurus start",
    "build": "docusaurus build && yarn pdf-from-build",
    "pdf-from-build": "npx docusaurus-pdf from-build build/ docs/flutter-crud2a/introduction --output-file build/img/docusaurus.pdf",
    "swizzle": "docusaurus swizzle",
    "deploy": "docusaurus deploy"
  },

Important part of scripts.

npx docusaurus-pdf from-build build/ docs/flutter-crud2a/introduction --output-file build/img/docusaurus.pdf

So, you can access generated PDF at https://www.yourdomain.com/img/docusaurus.pdf