Skip to content

Instantly share code, notes, and snippets.

@notiv-nt
Created December 30, 2018 21:15
Show Gist options
  • Save notiv-nt/476cb4f954083b99c09798c37ea9d38b to your computer and use it in GitHub Desktop.
Save notiv-nt/476cb4f954083b99c09798c37ea9d38b to your computer and use it in GitHub Desktop.
Gulp javascript task — parcel version
let PRODUCTION_MODE = process.argv.indexOf('--minify') !== -1;
const gulp = require('gulp');
const _ = require('gulp-load-plugins')();
gulp.task('javascript', () => {
const sources = ['./source/js/index.js', 'source/js/sw.js']
gulp.src(sources, { read: false })
.pipe(_.parcel({
minify: PRODUCTION_MODE,
outDir: './public/assets/js',
}))
.pipe(gulp.dest('./public/assets/js'));
});
{
"scripts": {
"build": "gulp --minify"
},
"dependencies": {
"gulp": "^3.9.1",
"gulp-load-plugins": "^1.5.0",
"gulp-parcel": "^0.3.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment