Last active
May 12, 2020 11:35
-
-
Save kshaner/d088c5428fd34fffc0deac79ef344e12 to your computer and use it in GitHub Desktop.
Gulp copy from NPM for front end scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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