How do I add Bower provided javascript to Google's Web Starter Kit

159 Views Asked by At

I've installed some Bower packages, and would like to include them in the Gulp build process. I've tried adding them to gulpfile.babel.js in the script section:

gulp.task('scripts', () =>
    gulp.src([
      // Note: Since we are not using useref in the scripts build pipeline,
      //       you need to explicitly list your scripts here in the right order
      //       to be correctly concatenated
      './bower_components/jquery/dist/jquery.js',
      './bower_components/bootstrap-sass/assets/javascripts/bootstrap.js',
      './app/scripts/main.js'
      // Other scripts
    ])
      .pipe($.newer('.tmp/scripts'))
      .pipe($.sourcemaps.init())
      .pipe($.babel())
      .pipe($.sourcemaps.write())
      .pipe(gulp.dest('.tmp/scripts'))
      .pipe($.concat('main.min.js'))
      .pipe($.uglify({preserveComments: 'some'}))
      // Output files
      .pipe($.size({title: 'scripts'}))
      .pipe($.sourcemaps.write('.'))
      .pipe(gulp.dest('dist/scripts'))
);

But that builds a seperate minified main.min.js in the /dist/scripts directory.

How can I import a script into the build pipeline to have it included in app/scripts/main.js?

Surely it can't be this difficult to do something as straightforward as adding Bower provided JS to a project. I can't find anything in documentation as to what's best practice.

0

There are 0 best solutions below