gulp-bower-flatten
v1.0.2
Published
This plugin flattens the dependencies in bower_components into the project home directory.
Downloads
2
Readme
This introduces two gulp tasks:
link
: to flatten dependencies managed by bower into the project home directory using symlinks. The root directory of each dependency can either be ignored (default behavior, which generates a fully flattened structure), or preserved (withskipDepRootDir
set to false)unlink
: to remove symlinks generated bylink
unlink does not support windows yet
This uses Brian's gulp-bower-src.
Example
.
|-- foo
|-- foo.js
|-- bower_components
|-- shared
|-- foo
|-- bar.js
|-- creative
|-- baz
This yields (skipDepRootDir = true
)
.
|-- foo
|-- foo.js
|-- bar.js@ -> ../bower_components/shared/foo/bar.js
|-- baz@ -> bower_components/creative/baz
|-- bower_components
|-- shared
|-- foo
|-- bar.js
|-- creative
|-- baz
or (skipDepRootDir = false
)
.
|-- foo
|-- foo.js
|-- shared
|-- foo@ -> ../bower_components/shared/foo
|-- creative@ -> bower_components/creative
|-- bower_components
|-- shared
|-- foo
|-- bar.js
|-- creative
|-- baz
where @ denotes a symlink
Integration
npm install gulp-bower-flatten --save
add it to your gulpfile.js
var flatten = require('gulp-bower-flatten');
gulp.task('link', flatten.link());
gulp.task('unlink', flatten.unlink());
// to pass options, use flatten.link(opts) and flatten.unlink(opts)
Options
link
skipDepRootDir
If set to true, all dependency root directories will be taken out, otherwise they will be preserved.
Type
boolean
Defaulttrue
all options will also be passed to gulp-bower-src
unlink
base
Specifies where to start cleaning all generated symlinks.
Type
string
Default.
How to Contribute
Prepare your dev environment:
npm install
Remember to run tests before you make a PR:
npm test