Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including docpad-plugin-bowermount with all npm packages installed. Try it out:

var docpadPluginBowermount = require("docpad-plugin-bowermount")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

docpad-plugin-bowermount v2.4.5

DocPad plugin that mounts bower components in web server middleware

bower-mount Plugin for DocPad

DocPad plugin that auto-mounts bower components and all files specified in RequireJS paths property in web server middleware (currently only JS components). Best fits for development environment. Assumes that in production environment JS files are bundled in static files.

It's enabled only in development environment by default

It runs only when docpad initially generates project files. So, if new bower components are added or new requirejs modules paths are specified in in paths directive, it's recommended to rerun docpad instance.

RequireJS and Bower configurations are a requirement


Make sure you have installed bower and have RequireJS configuration file installed and set up before you continue.

Install it from you Docpad project:

npm install docpad-plugin-bowermount --save-dev

Next time you run docpad run your bower components will be available via web.

For example, if you installed jquery via bower install jquery and docpad run creates server accessible via http://localhost:9778 you can access jquery lib via http://localhost:9778:/scripts/jquery.js out of the box. However if for example you installed require-handlebars-plugin then you'd need to manually specify paths in your requirejs configuration file.

You'd probably want to bundle your components into static files on build

RequireJS: you can set relative path to your configuration file in rjsConfig (default value is scripts/main.js) and if it exists, paths from there will be used to determine components path. Here is an example of your with this configuration:

# ==================
# Environment
        rjsConfig: 'path/to/my/requirejs/config'


You can discover the history inside the file


Licensed under the incredibly permissive MIT License
Copyright © 2013+ Sergey Lukin

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free