0

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');
    });
}));
Swift Dev Journal
  • 19,282
  • 4
  • 56
  • 66

1 Answers1

1

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

<script async src="app.min.js"></script>
anthumchris
  • 8,245
  • 2
  • 28
  • 53
  • Please can you say what is differences between **async** and **defer** and which property should I use? – user7393570 Apr 27 '20 at 08:28
  • Defer executes multiple script tags in order listed in html. I recommend async if execution order is unneeded. – anthumchris Apr 27 '20 at 09:25
  • Thanks @AnthumChris for your response , but as I understand I can't using **async** with combined node_modules scripts in my angular js app. – user7393570 Apr 27 '20 at 09:57