Another approach:
what you installed:
- gulp
- introductory sequence
- master bower files
- gulp -inject
If you do not want, you can install with npm as:
npm install gulp run-sequence main-bower-files gulp-inject
Saving dependencies in html file
After that, we start setting up gulp tasks
gulp.task("bower:copyfiles", function(cb){
return gulp.src(mainBowerFiles())
.pipe(gulp.dest('./src/lib'))
cb();
});
gulp.task('bower:insertfiles', function(cb){
return gulp.src('./src/index.html')
.pipe(inject(gulp.src(['./src/lib/*.js', './src/lib/*.css'], {read: false}), {
starttag: '<!-- bower:{{ext}} -->',
endtag: '<!-- endbower -->',
relative:true
}
))
.pipe(gulp.dest('./src'));
})
gulp.task('bower:buildlib', function(cb) {
runSequence('bower:copyfiles', 'bower:insertfiles',cb);
})
Now we have half the process, we need to insert the tags in index.html so that gulp knows where it should include content
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
</html>
-
gulp bower:buildlib
:
, , bower, . f.e.: bootstrap, css , bower.json( bower_components - , ) . bower.json , ( ):
"overrides":{
"bootstrap":{
"main":[
"dist/js/bootstrap.js",
"dist/css/bootstrap.min.css",
"less/bootstrap.less"
]
}
}
, , .