gulp-inject-string is a Gulp plugin designed to facilitate the injection and manipulation of string content within file streams during a build process. It provides a set of nine distinct methods, including `append`, `prepend`, `wrap`, `before`, `after`, `beforeEach`, `afterEach`, and `replace`, to programmatically modify the contents of files like HTML, JavaScript, or CSS as they pass through a Gulp pipeline. The current stable version is 1.1.2, released in January 2018. Development appears to be mature but largely inactive since then, indicating a stable but infrequently maintained state. Its primary differentiator is its straightforward, method-chaining API for precise string insertions and replacements, making it a utility for tasks like adding build timestamps, injecting script tags, or embedding environment-specific markers into source files during a build.
npm install gulp-inject-stringVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `gulp-inject-string` to replace a script filename in an HTML file with a minified and cache-busted version during a Gulp build process. It creates a dummy `src/example.html` and outputs a modified `build/index.html`.
Always test `gulp-inject-string` with your target Node.js and Gulp versions. Consider alternatives if frequent updates or advanced features are required.
Migrate Gulp task composition to `gulp.series()` for sequential execution or `gulp.parallel()` for concurrent execution, e.g., `gulp.task('default', gulp.series('task1', 'task2'));`.Use `const inject = require('gulp-inject-string');` for all imports of this module within Node.js environments.Ensure you are using `const inject = require('gulp-inject-string');`. If using ES Modules, you might need a transpiler or a dynamic import for CommonJS modules, or to wrap the `require` call if the environment supports it.Ensure your Gulp tasks return the stream (e.g., `return gulp.src(...).pipe(...)`), return a Promise, or explicitly call `done()` if a callback is passed to the task function.
No dependency data recorded yet.