Bower. How to set base forder for main directories?

70 Views Asked by At

I override the main directories for the Bootstrap in bower.json:

"main" : [
              "./dist/css/bootstrap.css",
              "./dist/css/bootstrap.css.map",
              "./dist/css/bootstrap-theme.css",
              "./dist/css/bootstrap-theme.css.map",
              "./dist/js/bootstrap.js",
              "./dist/fonts/*",
              "./less/**"
]

And I want that a files were copied with css, js, fonts folders. I.e. can I set '/dist/' as a base forder?

Or can I do it in the gulp task? In gulpfile.js I wrote:

var files = mainBowerFiles('**/dist/**');
return gulp.src( files, {base: 'C:/Users/Den/Desktop/HTML5-Demo/bower_components/bootstrap/dist/'} )
            .pipe( gulp.dest('public_html/libs') );

But I'm forced to write a full path which of course is bad. Is there way to use a relative path?

Also I want to ask what does '.' in the beginning of the directories mean?

1

There are 1 best solutions below

0
On

To use relative path you need to get current working directory.

var path = require('path');
var cwd = process.cwd(); // current working directory
var basePath = path.resolve(cwd, "bower_components/bootstrap/dist");

The next code works:

var stream = gulp.src(files, {base: './bower_components/bootstrap/dist'})