bitovi / documentjs

The sophisticated documentation engine
https://documentjs.com/
MIT License
598 stars 381 forks source link

Auto copy demos to output folder #198

Open tomgreever opened 9 years ago

tomgreever commented 9 years ago

DocumentJS currently does not move the demos into the output folder and this makes it difficult to add demos to the generated docs. One can do it manually, but I've taken to creating a grunt task that handles this. This seems like a basic missing feature.

Suggestion

The @demo tag should point to the current location of the demo file and then DocumentJS should grab the file and move it to a common demos folder inside the output folder. Then it would update the relative link to the demo in the outputted HTML.

For example

@demo demos/bootstrap/components/grid.html

Would get copied to:

/output/folder/demos/bootstrap/components/grid.html

Also possible that we should rename the demo files (to avoid name conflicts) and put them all in the demo folder flat. I don't think this would cause any problems. That way, the user can put the demo file wherever they want and DocJS copys/moves/renames it and updates the link.

Ref https://github.com/bitovi/documentjs/issues/116

justinbmeyer commented 9 years ago

This is a big problem, the the fix isn't simple. Most demo pages reference external scripts and styles. Those would also have to be moved. This can't be done in a deterministic fashion.