Preparing the JavaScript plugins
Some of Bootstrap's components do not only require CSS but also JavaScript. Bootstrap comes with jQuery plugins for commonly used components. Similarly, the navbar requires the collapse plugin and the carousel component has its own plugin too.
Bootstrap's plugins require jQuery and the Tooltips and Popover components also require the Tether library.
In the build process, you can bundle jQuery, Tether, and the plugins into a single file by using the gulp-concat
plugin.
You can install the gulp-concat
plugin by running the following command in your console:
npm install gulp-concat --save-dev
After that the task that bundles the JavaScript files may look like:
gulp.task('compile-js', function() { return gulp.src([bowerpath+ 'jquery/dist/jquery.min.js', bowerpath+ 'tether/dist/js/tether.min.js', bowerpath+ 'bootstrap/dist/js/bootstrap.min.js','js/main.js']) .pipe(concat('app.js')) .pipe(gulp.dest('./_site/js/')); });
The preceding...