clenemt/docdash

[enhancement wish] common nav for all html pages

dcaillibaud opened this issue · 4 comments

Hi,

On a quite big js project, generated documentation is 1224 files of 2Mo each (2,3Go). It's because the

part has a weight of 1.9Mo.

Having only one <nav> content for all files could reduce a lot the total weight, here around 200 times less (1224×2000 vs 1900 + 1224×100, in my case from 2.3Go to ~125Mo).

It could be done with a frameset, or an ajax call to populate the nav bar in each html page (the nav.html will be in the browser cache after the first call).

Is such an enhancement can be put on the roadmap ?

BTW, thanks a lot for this great template.

With some clues about how to achieve this I can try to make a PR.

I guess the way to go about this would be

  1. Based on the config option, hide the nav side with search from layout file (https://github.com/clenemt/docdash/blob/master/tmpl/layout.tmpl) and adjust all other needed CSS tweaks if any
  2. create a new template with navigation and iframe and based on the same config, export it as main index file: https://github.com/clenemt/docdash/blob/master/publish.js#L706-L710
  3. based on the same config modify navigation building to call some js function that will change the source of iframe instead of going to another HTML page (https://github.com/clenemt/docdash/blob/master/publish.js#L428), you will probably have to wrap linkto function for that

I think that is bout it :)

Thanks for these detailed clues.

I'll try to add a new config option "iframeNav" and handle it in templates. If it works as I want I'll make a PR.

After a big delay I made it : #95

It's not an iframe, really easier fetching html code and add it directly in the page (included html should be in browser cache after the first page display)