Answer the question
In order to leave comments, you need to log in
How to organize library files into folders in gulp using main-bower-files?
Hello, tell me how you can decompose library files into their folders, for example:
If you use such a task, then all files will fall into one lib folder
gulp.task('bower', function() {
gulp.src(mainBowerFiles({
"overrides": {
"jquery": {
"main": "./dist/jquery.min.js"
},
"bootstrap-grid": {
"main": [
'./dist/bootstrap-grid.min.css'
]
}
}
}))
.pipe(gulp.dest('./lib/'))
});
Answer the question
In order to leave comments, you need to log in
I did it, does anyone have a better option?
gulp.task('bower', function() {
var mainBowerFilesArr = mainBowerFiles({
'overrides': {
'jquery': {
'main': './dist/jquery.min.js'
},
'bootstrap-grid': {
'main': './dist/bootstrap-grid.min.css'
}
}
}).map( function(path) {
return path;
});
for (var i = mainBowerFilesArr.length - 1; i >= 0; i--) {
var p = mainBowerFilesArr[i].substring(mainBowerFilesArr[i].indexOf('bower_components'));
var f = p.split('\\')[1]+'/';
gulp.src(p).pipe(gulp.dest(path.build.lib+f));
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question