find-npm-assets
Recursively find assets in npm packages.
To define assets in a package, add an assets
field to the package.json
containing an array of file globs to include.
Example
Let's say you have a package named my-site
, which contains some assets and npm dependencies that in turn contain additional assets:
You could retrieve all your project assets with:
var assets = ; // Example output:// ["src/app/assets/**/*", "logo.png", "background.jpg"]
Gulp usage
Integrating find-npm-assets with gulp is extremely easy. The following gulp task copies all your project assets to a destination folder:
var assets = ; gulp;
For projects with assets coming from multiple packages it is recommended to set the pkgDir
property, which allows assets to be organized by project name:
var assets = ; gulp // Example output:// [{// name: project1,// assets: ["src/app/assets/**/*", "logo.png", "background.jpg"]// }, {// name: project2,// assets: ["src/app/assets/**/*", "logo.png", "background.jpg"]// }]
Reference
To output debug information, pass an object with a debug
property set to true to the load
method:
var assetFind = ;assetFind;
You can run find-npm-assets
from the command line, the -v
argument will trigger debug information and -m
will trigger the pkgDir
option.
License
See LICENSE file.