gleam icon indicating copy to clipboard operation
gleam copied to clipboard

Bundle all JS libraries with generated docs so that they can be used offline

Open inoas opened this issue 2 years ago • 4 comments

When distributing libraries we could/should distribute the full generated documentation, so that using hexdocs.pm is optional / no internet connection is required.

Are there plans to ever make the generated docs available locally? If so would it be wise to start bundling docs assets locally such as https://github.com/gleam-lang/gleam/pull/1712/files#diff-35e517b7b2494a23576f20256e6a64bd9b258e2f0e089b2752d9f2eb4ae346e0R294

They are gleam docs build Oh like the assets Yeah good idea! Could you make an issue?

Ref: https://discord.com/channels/768594524158427167/811254431051808778/1009422223712452668

Note: The current generated docs use CDN'ed assets and future docs should ship with local assets.

Further ideas:

  • We could also generate a meta docs file that allows searching all locally installed deps' docs and/or also just lists them in a tree to click the doc and get to that.
  • Deps that require other deps could als be crosslinked in their HTML documentation.

inoas avatar Aug 17 '22 14:08 inoas

Great suggestion! Thank you

lpil avatar Aug 22 '22 18:08 lpil

@lpil FWIW I started to play around with this. I added a templates/index.js that references the files that are currently loaded via CDN and that is then built using esbuild into templates/dist/index.js and templates/dist/index.css. Is that an approach you'd be okay with given that it requires npm and esbuild during the build/CI process?

The alternative would be to a) store copies of all assets in the gleam repo and manually handle updates (wouldn't recommend) b) run npm install and/or esbuild and commit the resulting node_modules and/or built assets to the gleam repo.

aflatter avatar Sep 15 '22 22:09 aflatter

Fantastic, thank you.

I would like to save the modified versions of each library into the repository and then have a link in the HTML to each one. We definitely do not want to depend upon npm or require any JavaScript build tooling in order to compile Gleam.

lpil avatar Sep 15 '22 23:09 lpil

Thank you so much!

inoas avatar Sep 16 '22 14:09 inoas

I think this is actually completed already, if not reopen please.

inoas avatar Feb 06 '23 21:02 inoas