Wiredep CLI
This package, `wiredep-cli`, provides a command-line interface for `wiredep`, a tool designed to automatically inject Bower front-end dependencies into HTML, CSS, and JS files. Its primary function was to automate the inclusion of `<script>` and `<link>` tags based on the `bower.json` manifest. The package, version 0.1.0, and its core dependency `wiredep` (version 0.11.0) were both last updated in March 2016. Given that Bower itself has been officially deprecated since 2017 in favor of modern front-end package managers like npm/Yarn and build tools like Webpack, `wiredep-cli` is no longer actively maintained or relevant for contemporary web development workflows. This tool is part of an abandoned ecosystem.
Common errors
-
wiredep command not found
cause The `wiredep` CLI tool (which `wiredep-cli` wraps or works in conjunction with) is not installed globally or is not in the system's PATH.fixInstall `wiredep` globally: `npm install -g wiredep`. Also ensure `wiredep-cli` is installed: `npm install -g wiredep-cli`. -
Bower components not being injected into HTML/CSS.
cause This can be due to incorrect paths to `bower.json` or the Bower components directory, missing `main` fields in `bower.json` of dependencies, or improper `<!-- bower:type -->` comments.fixVerify `--bowerJson` and `--directory` options point to the correct locations. Check `bower.json` files for missing `main` entries and use `overrides` if necessary. Ensure correct HTML/CSS comment blocks exist for injection. Run `bower install` to ensure components are present. -
Error: Cannot find module 'wiredep'
cause Although `wiredep-cli` is a CLI, if `wiredep` itself is invoked programmatically (e.g., in a Gulp/Grunt task), this error indicates `wiredep` is not installed as a local dependency.fixInstall `wiredep` locally as a dependency: `npm install --save-dev wiredep`.
Warnings
- breaking The entire Bower package manager ecosystem, which `wiredep-cli` relies upon, has been officially deprecated since 2017. Modern front-end development has moved to npm/Yarn/pnpm for package management and Webpack/Rollup/Vite for bundling.
- gotcha `wiredep-cli` and its core `wiredep` library have not been updated since March 2016. This means they are unmaintained and may not work with newer versions of Node.js, npm, or contemporary browser features.
- gotcha The `wiredep` tool (and thus `wiredep-cli`) expects specific `<!-- bower:js -->` and `<!-- endbower -->` HTML comments to identify injection points. Incorrectly placed or missing comments will prevent dependencies from being injected.
- gotcha Packages must be saved as Bower `dependencies` (using `bower install --save`) to be injected by `wiredep` by default. `devDependencies` are typically ignored unless explicitly configured.
Install
-
npm install wiredep-cli -
yarn add wiredep-cli -
pnpm add wiredep-cli
Quickstart
npm install -g wiredep-cli npm install -g wiredep # wiredep is often installed globally for CLI use with wiredep-cli bower init --yes # Initialize a bower.json if not present bower install jquery --save # Install a sample Bower package # Create a dummy HTML file cat > index.html << EOF <!doctype html> <html> <head> <!-- bower:css --> <!-- endbower --> </head> <body> <!-- bower:js --> <!-- endbower --> <p>Hello from Wiredep!</p> </body> </html> EOF # Run wiredep-cli to inject dependencies wiredep --src index.html cat index.html # View the updated HTML with injected scripts