Skip to content

Instantly share code, notes, and snippets.

@tterb
Last active September 25, 2020 17:39
Show Gist options
  • Save tterb/c38b799df802ee93b055ec24cd8bd9e0 to your computer and use it in GitHub Desktop.
Save tterb/c38b799df802ee93b055ec24cd8bd9e0 to your computer and use it in GitHub Desktop.
Gulpfile scripts
// Concatenate and uglify global JS files and output the result to the
// appropriate location
gulp.task('build:scripts:global', function() {
return gulp.src([
paths.jsFiles + '/lib' + paths.jsPattern,
paths.jsFiles + '/*.js'
])
.pipe(concat('main.js'))
.pipe(uglify())
.pipe(gulp.dest(paths.jekyllJsFiles))
.pipe(gulp.dest(paths.siteJsFiles))
.on('error', gutil.log);
});
// Uglify local JS files and output the result to the appropriate location
gulp.task('build:scripts:local', function() {
return gulp.src(paths.jsFiles + '/local' + paths.jsPattern)
.pipe(uglify())
.pipe(gulp.dest(paths.jekyllJsFiles))
.pipe(gulp.dest(paths.siteJsFiles))
.on('error', gutil.log);
});
// Build all scripts
gulp.task('build:scripts', ['build:scripts:global', 'build:scripts:local']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment