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.
.
|-- 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
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)
-
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
-
base
Specifies where to start cleaning all generated symlinks.
Type
string
Default.
Prepare your dev environment:
npm install
Remember to run tests before you make a PR:
npm test