gulp-process-inline

Process parts of HTML files directly inline with Gulp

Usage no npm install needed!

<script type="module">
  import gulpProcessInline from 'https://cdn.skypack.dev/gulp-process-inline';
</script>

README

Gulp Process Inline

Process sections of HTML files (eg: scripts, styles) directly inline with Gulp.

Installation

Install gulp-process-inline with NPM

npm install --save-dev gulp-process-inline

Usage

gulp-process-inline takes a HTML selector, pulls its content out into a stream that you pipe to other Gulp plugins, then writes the transformed content back to HTML.

To use it just call .extract() with the HTML selector you want, then call .restore() when you want to write the contents back to HTML. Every instance of the selector in a given file will be iterated over and processed.

var gulp = require('gulp');
var processInline = require('gulp-process-inline');

gulp.task('scripts', function() {
  return gulp.src('./src/index.html')
    .pipe(processInline().extract('script'))
      // Pipe other gulp plugins here
      // eg: .pipe(uglify())
    .pipe(processInline().restore())
    .pipe(gulp.dest('./dist'));
});

License

MIT © Bede Overend