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 🙏

© 2026 – Pkg Stats / Ryan Hefner

require-wiredep

v0.1.4

Published

Inject require configs to your source code.

Readme

require-wiredep

Wire require config to many files

Getting Started

Install the module with npm:

$ npm install --save require-wiredep

Prepare require-config.js file

var config = {
  default: {
    "baseUrl": "",
    "paths": {
      "app": "scripts/app",
      "bootstrap": "scripts/bootstrap",
      "config": "scripts/config",
      "angular": "bower_components/angular/angular",
      "angularAMD": "bower_components/angularAMD/angularAMD",
      "angular-mocks": "bower_components/angular-mocks/angular-mocks"
    },
    "packages": [
      {
        "name": "myWidget",
        "location": "bower_components/myWidget/dist/component/src",
        "main": "js/component"
      },
    ],
    "shim": {
      "angularAMD": ["angular"],
      "angular-mocks": ["angular"],
      "angular-resource": ["angular"]
    },
    "priority": ["angular", "angularAMD"],

    "deps": ["/scripts/bootstrap.js"]
  },
  extended: {
    "baseUrl": "/base/",
    "paths": {
      "Api": "scripts/services/Api",
      "ApiResource": "scripts/services/ApiResource",
      "modalView": "views/NextStepWidget/modal.html"
    }
  },
  test: {
    "url_prefix": "app/",
    "url_postfix": "test",
    "url_prefix_exclude": ["bower_components"],
    "url_postfix_exclude": ["bower_components"],
    "callback": function() {
      console.log('do something');
    }
  }
};

module.exports = config;

Above you can see example config file for require-wiredep. Config can contain many targets with configs. Main and required target is default, by using another targets we have possibility to extend default configuration.

Insert placeholders in your code where your config will be injected

There is two possibilities to inject config to you file:

  • Target style by using require:target placeholder
var config = {
  //require:default
  //endrequire
  }
  • Property style by using require:target:property placeholder
var config = {
  "paths":
  //require:default:paths
  //endrequire
  }

Let require-wiredep work its magic:

$ node
> require('require-wiredep')({ src: 'main.js' });

main.js modified.

Supported properties of require config

  • baseUrl
  • paths
  • packages
  • shim
  • priority
  • deps
  • callback

Additional properties

  • url_prefix - Add prefix to all url in config
  • url_postfix - Add postfix to all url in config
  • url_prefix_exclude - Exclude prefix for url consisting strings passed in array
  • url_postfix_exclude - Exclude postfix for url consisting strings passed in array

Grunt

See grunt-require-wiredep.

Command Line

Install require-wiredep globally to wire up configs from the terminal.

$ npm install -g require-wiredep
$ require-wiredep
Inject require configs to your source code.

Usage: $ require-wiredep [options]

Options:
  -h, --help         # Print usage information
  -v, --version      # Print the version
  -b, --requireUrl    # Path to `require-config.js`
  -s, --src          # Path to your source file

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using npm test.

License

Copyright (c) 2014 Pearson English. Licensed under the MIT license.