Code Monkey home page Code Monkey logo

elm-docs-preview's Introduction

Elm Docs Preview

Preview the docs for your awesome Elm libs locally. Sounds good? Just do this!

npm i -g elm-docs-preview

Then run it with a path to the directory of your package (which contains elm-package.json).

# for the current directory
elm-docs-preview

# or for any directory
elm-docs-preview path/to/elm-package

This will spin up a server at http://localhost:8080, which will serve an HTML and show the compiled docs.

Requirements

  • Node version 8 or higher.

What's happening?

When running elm-docs-preview this will:

  • run elm make in the directory you specified to generate the docs.json.
  • then it will generate an HTML page, which displays the JSON data in the format you as a package author are used to from package.elm-lang.org
  • spin up a server to display that page

Room for improvement

  • As live reloading is not implementing yet you'll have to run this again everytime you make changes and wanna preview them(should watch the exposed modules of a package)
  • Code for the UI was shamelessly taken and adapted from package.elm-lang.org. The code likely still contains a bunch of unnecessary stuff from the original version, but this was the quickest way to make this previewer.
  • Assets are still fetched from package.elm-lang.org (should maybe be copied into this package so it doesn't break if the package site is down)
  • Currently the server for previewing is webpack-dev-server. It makes generating everything very easy and I picked it mostly for comfort, but I'm not sure if there aren't better choices out there.
  • In some cases the links don't work yet. For simplicity everything uses hash routing but in some cases that may not be enough(i.e. when viewing module A and clicking a link to some function in Module B)

elm-docs-preview's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

elm-docs-preview's Issues

Breaks with Elm 0.19.0

First it breaks because of the check for elm-package.json which will never exist, since it will be replaced by elm.json.

But even when fixing that and using the new elm make command, the website shows an error:

Problem reading the docs file: Could not parse file contents as Elm docs. Expecting an object with a field named `types` at _[0][1] but instead got: 
[redacted]

It seems as if the doc format changed.

Is this something that can be fixed easily?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.