Skip to content

Instantly share code, notes, and snippets.

@choyan
Created January 7, 2020 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save choyan/ef4a8966d28692ce7456d489e50df7ce to your computer and use it in GitHub Desktop.
Save choyan/ef4a8966d28692ce7456d489e50df7ce to your computer and use it in GitHub Desktop.
Gulp 4 configuration for gulp-inject
const gulp = require('gulp');
const inject = require('gulp-inject');
// use to concat css files
function injectIntoHTML() {
// It's not necessary to read the files (will speed up things), we're only after their paths:
let sources = gulp.src(['./src/**/*.js', './src/**/*.css'], {read: false});
return gulp
.src('./src/index.html')
.pipe(inject(sources))
.pipe(gulp.dest('./dist/'));
}
const InjectTasks = gulp.series([injectIntoHTML])
exports.inject = InjectTasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment