Search code examples
dartgithub-pagesdart-pub

How do I resolve dart pub publish vs github pages doc directories conflict?


To publish to GitHub pages, documentation must be in either the repository's root directory (/) or in docs. The standard directory location for dart documentation is doc/api. If I try to publish a library to pub.dev, dart pub publish is happy with doc/api, but not docs. I suppose one solution would be to set up GitHub Actions for the repository to generate the documentation in doc\api, publish the library, then generate or copy (move?) the documentation to the docs directory, but this seems overkill for a small library.

What is the best way to resolve this conflict?


Solution

  • You can create a .pubignore file with the /docs folder so that this folder won't be included in pub publish.

    Here is a sample of .pubignore file