Skip to content

Instantly share code, notes, and snippets.

@kshaner
Last active May 12, 2020 11:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kshaner/d088c5428fd34fffc0deac79ef344e12 to your computer and use it in GitHub Desktop.
Save kshaner/d088c5428fd34fffc0deac79ef344e12 to your computer and use it in GitHub Desktop.
Gulp copy from NPM for front end scripts
const pkg = require('./package.json');
const gulp = require('gulp');
const nodePath = require('path');
// project
const project = {};
project.node = 'node_modules';
project.dist = nodePath.posix.normalize(`${project.assets}/dist`);
project.vendor = nodePath.posix.normalize(`${project.assets}/vendor`);
const vendor = function() {
const npmFiles = Object.keys(pkg.dependencies).map((name) => `${project.node}/${name}/**/*`);
return gulp.src(npmFiles, { base: project.node })
.pipe(gulp.dest(project.vendor));
}
gulp.task('build:vendor', vendor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment