Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

gulp task for /source/vendor is including too many files for build #36

Open
mpiasta-ca opened this issue Oct 7, 2014 · 0 comments
Open

Comments

@mpiasta-ca
Copy link

  1. Should only copy required files (ie. js, css). Should NOT copy bower.json, README.md, MIT-LICENSE.txt, etc. Looks like bower.json declares the main: file that needs to be included.
  2. Vendor files need to be minified (ie. require.js). (Edit: I see it's supposed to be doing that, in gulp js, but for some reason it's not working)

You can use something like gulp-bower or gulp-bower-files to only copy the required files.

[Edit:] Found the problem. Looks like after build/vendor files are copied, that somehow cancels out the changes made to require.js. You have to exclude require.js from the vendor copy task, and then just copy/minify directly from source. This works:

gulp.task('copy', ['sass'], function () {
  return es.concat(
    // update index.html to work when built
    gulp.src(['source/index.html'])
      .pipe(gulp.dest('build')),
    // copy config-require
    gulp.src(['source/js/config-require.js'])
      .pipe(uglify().on('error', handleError))
      .pipe(gulp.dest('build/js')),
    // copy template files
    gulp.src(['source/js/**/*.html'])
      .pipe(gulp.dest('build/js')),
    // copy vendor files
    gulp.src(['source/vendor/**/*', '!source/vendor/requirejs/require.js'])
      .pipe(gulp.dest('build/vendor')),
    // copy assets
    gulp.src(['source/assets/**/*'])
      .pipe(gulp.dest('build/assets')),
    // minify requirejs
    gulp.src(['source/vendor/requirejs/require.js'])
      .pipe(uglify())
      .pipe(gulp.dest('build/vendor/requirejs'))
  );
});

[Edit:] gulp-bower-files is deprecated. Take a look at 'main-bower-files' instead.

@mpiasta-ca mpiasta-ca changed the title Copy of /vendor needs optimization gulp copy of /vendor needs optimization Oct 7, 2014
@mpiasta-ca mpiasta-ca changed the title gulp copy of /vendor needs optimization gulp copy of /source/vendor moving too many files to build Oct 8, 2014
@mpiasta-ca mpiasta-ca changed the title gulp copy of /source/vendor moving too many files to build gulp task for /source/vendor is including too many files for build Oct 8, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant