Using gulp to install jquery & bootstrap4 returns

2019-07-14 03:15发布

问题:

I am trying to build a wordpress site with bootstrap as a dependency using npm and gulp but cant seem to figure out why I keep getting this error when trying to run gulp:

$$$1.fn.emulateTransitionEnd = transitionEndEmulator;
                             ^
TypeError: Cannot set property 'emulateTransitionEnd' of undefined

I installed jquery, popper and bootstrap using gulp and have added the following lines to my gulpfile.js:

var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var jquery = require('jquery');
var popperjs = require('popper.js');
var bootstrap = require('bootstrap');

gulp.task('sass', function(){
    return gulp.src(['node_modules/bootstrap/scss/bootstrap.scss', './sass/**/*.scss'])
    .pipe(sass())
    .pipe(gulp.dest('./'))
});

gulp.task('js', function(){
    return gulp.src(['node_modules\jquery\dist\jquery.min.js', 'node_modules\popper.js\dist\popper.min.js', 'node_modules/bootstrap/dist/js/bootstrap.min.js', './js/*.js'])
    .pipe(concat('app.js'))
    .pipe(gulp.dest('./js'))
});

gulp.task('watch', function(){
    gulp.watch('./sass/**/*.scss', ['sass']);
    gulp.watch('./js/*.js', ['js']);
});

gulp.task('default', ['sass', 'js', 'watch']);

What am I doing wrong so far?