1.1.0 • Published 2 years ago
gulp-append-prepend-no-trim v1.1.0
gulp-append-prepend-no-trim
Fork from the original gulp-append-prepend by JamesHemery.
Simple 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.