gulp-append-prepend-no-trim
gulp-append-prepend by JamesHemery.
Fork from the originalSimple Gulp plugin.
Usage
First, install gulp-append-prepend-no-trim as a development dependency:
npm install gulp-append-prepend-no-trim --save-dev
Then, add it to your gulpfile.js:
const { prependText, prependFile, appendText, appendFile } = require('gulp-append-prepend-no-trim');
function myAwesomeTask() {
return src('index.html')
.pipe(prependFile('header.html'))
.pipe(prependText('<!-- HEADER -->'))
.pipe(appendText('<!-- FOOTER -->'))
.pipe(appendFile('footer.html'))
.pipe(dest('www/'));
}
This example works with html but you can use any type of file.
Methods
-
appendFile(filepath, separator)
The filepath can be an array. The separator is optional by default is "\n". -
prependFile(filepath, separator)
The filepath can be an array. The separator is optional by default is "\n". -
appendText(text, separator)
The text can be an array. The separator is optional by default is "\n". -
prependText(text, separator)
The text can be an array. The separator is optional by default is "\n".
Licence
This plugin is released under the MIT licence.
Disclaimer
Feel free to make changes in this README.