Combine js files into one and make it inline script

305 Views Asked by At

How can i combine multiple JavaScript files into one and make it inline script. Currently I can combine into one file using gulp usemin but i can't do it as inline script . I want to solve render blocking request issue. My question is following is it possible to do it?

This is a part of code

<!-- build:js scripts/plugins.js -->
   <!-- endbuild -->

gulp.task('usemin', gulp.series('inject', 'less', function(callback) {
  return gulp.src('./app/index.html')
    .pipe(usemin({
      //  js: [ngAnnotate,uglify]
    }))
    .pipe(gulp.dest(currentDir))
    .on('end', function () {
      del('./app/index.html');
    });
}));
1

There are 1 best solutions below

3
On

You could potentially use the async or defer attributes on your script instead:

<script async src="app.min.js"></script>