Skip to content

This smartly flattens your bower dependencies into your source directory using symlinks.

License

Notifications You must be signed in to change notification settings

X-corpion/gulp-bower-flatten

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This introduces two gulp tasks:

  1. 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 (with skipDepRootDir set to false)

  2. unlink: to remove symlinks generated by link

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 Default true

    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

About

This smartly flattens your bower dependencies into your source directory using symlinks.

Resources

License

Stars

Watchers

Forks

Packages

No packages published