gitbook-plugin-custom-jquery-postprocessing

1.0.1 • Public • Published

customJquery

After each page is renedered, allows you to modify the raw HTML with jquery before serving. Use this instead of running javascript on each page load to add/remove HTML for each page.

⚠️ This is super hacky, there are most likely 1,000,000 different and better ways to accomplish what this does 😎 ⚠️

Book.json

Require this by adding customJquery@git+https://github.com/dtolb/gitbook-plugin-customJquery.git to the plugins

customJquery requies a .js file to be passed as the object for pluginsConfig

{
    "plugins": ["customJquery@git+https://github.com/dtolb/gitbook-plugin-customJquery.git" ],
    "pluginsConfig": {
      "customJquery": {
        "js": "js/custom.js"
      }
    }
}

js file.

The .js file should export a single function. The plugin will call the function with $ as the only parameter. The .js file should return the renderened $.html(); when complete

Example .js file

module.exports = function ($) {
    // Do jquery here
    return $.html();
}

Readme

Keywords

none

Package Sidebar

Install

npm i gitbook-plugin-custom-jquery-postprocessing

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • dtolb