npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-processdocstrapdocs

v0.0.3

Published

Post-process generated JSDoc documentation based on docstrap templates.

Downloads

13

Readme

grunt-processdocstrapdocs

Build Status Built with Grunt

Npm Downloads

Post-process generated JSDoc documentation based on docstrap templates.

Issues Addressed

Some issues with the generated templates are:

  1. There are may relative URLs in the generated documation CSS and HTML files, such as all CSS files starting with an @import url('//fonts.googleapis.com/...') import statement, which results in a relative path to the URL. That means when docs are loaded locally, the resulting absolute path uses a file:// protocol, which means the fonts fail to load -- which, depending on the system, can take a really long time (to resolve an invalid URL) and be really annoying when navigating the documentation.

    This is specifically logged as https://github.com/terryweiss/docstrap/issues/26

    This issue is fixed by converting all URLs to absolute paths, as configured.

  2. The templates use the navbar-fixed-top style to keep the top toolbar visible while scrolling vertically, but when clicking on an inline link (e.g. a method for the class being viewed), the page scrolls to the right location but the method's name and signature end-up hidden behind the fixed top navbar/toolbar.

    In reality, this issue could/should be handled by customizing your template, but in my case, that seemed like a lot of work when this quick post-processing would do the trick. This option is disabled by default.

    This issue is fixed by removing the navbar-fixed-top style from the top navbar.

    Note: Later releases of built-in JSDoc templates have addressed this issue so setting this option is no longer necessary (at least as of JSDoc 3.3.2 or even earlier).

Note: For this task, each source is also a destination. Destinations are ignored (i.e. modifiations will be made to each source directory specified).

Big thanks to Terry Weiss (and contributors) for really nice JSDoc templates at https://github.com/terryweiss/docstrap!

Installation

npm install grunt-processdocstrapdocs --save-dev

Configuration

//// gruntfile.js:

grunt.initConfig({
  jsdoc: {
    // your existing configuration
  },
  processdocstrapdocs: {
    options: {
      fixProtocol: true,
      protocol: 'http',
      fixTopNavbar: true
    },
    dist: {
      src: 'docs'
    }
  }
});

grunt.registerTrask('docs', ['jsdoc', 'processdocstrapdocs']);

//// command line:

$ grunt docs

Note that the processdocstrapdocs task must depend on the jsdoc task, that your jsdoc task is expected to be configured to use one of the provided ink-docstrap templates.

Settings

src

{(String|Array.<String>)} src (required)

The directory (String), or list of directories (Array.<String>), that contain generated JSDoc documentation based on an ink-docstrap template.

Options

fixProtocol

{Boolean} [fixProtocol=true] (optional, default: true)

Fix the relative protocols, changing them all to use the value of the protocol option.

protocol

{String} [protocol='http'] (optional, default: 'http')

Protocol to use when fixing relative protocols with fixProtocol enabled.

fixTopNavbar

{Boolean} [fixTopNavbar=false] (optional, default: false)

Fix the top navbar issue by letting it scroll with content.

This option is false by default since this really should be handled by customizing your template and the latest version of JSDoc (3.3.2 at this time) has fixed the issue in their built-in templates.

TODO

  • add some real tests