1. gulp-append-prepend
Simple Gulp plugin to append/prepend.
gulp-append-prepend
Package: gulp-append-prepend
Created by: JamesHemery
Last modified: Sat, 18 Jun 2022 16:35:54 GMT
Version: 1.0.9
Downloads: 47,899
Repository: https://github.com/JamesHemery/gulp-append-prepend

Install

npm install gulp-append-prepend
yarn add gulp-append-prepend

gulp-append-prepend

Simple Gulp plugin.

License:MIT
npm
Build

Usage

First, install gulp-append-prepend as a development dependency:

npm install gulp-append-prepend --save-dev

Then, add it to your gulpfile.js:

 const gap = require('gulp-append-prepend');

gulp.task('myawesometask', function(){
    gulp.src('index.html')
        .pipe(gap.prependFile('header.html'))
        .pipe(gap.prependText('<!-- HEADER -->'))
        .pipe(gap.appendText('<!-- FOOTER -->'))
        .pipe(gap.appendFile('footer.html'))
        .pipe(gulp.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

I am sorry for my poor English. Feel free to make changes in this README.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin