Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jameshemery/gulp-append-prepend

:heavy_plus_sign: Simple Gulp plugin to append/prepend.
https://github.com/jameshemery/gulp-append-prepend

gulp gulp-plugins plugin tool

Last synced: 4 months ago
JSON representation

:heavy_plus_sign: Simple Gulp plugin to append/prepend.

Awesome Lists containing this project

README

        

# gulp-append-prepend

Simple Gulp plugin.

[![License:MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/JamesHemery/gulp-append-prepend/blob/master/LICENCE)
[![npm](https://img.shields.io/npm/v/gulp-append-prepend.svg)](https://www.npmjs.com/package/gulp-append-prepend)
[![Build](https://travis-ci.org/JamesHemery/gulp-append-prepend.svg)](https://travis-ci.org/JamesHemery/gulp-append-prepend)

## Usage

First, install gulp-append-prepend as a development dependency:
```
npm install gulp-append-prepend --save-dev
```

Then, add it to your gulpfile.js:

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

gulp.task('myawesometask', function(){
gulp.src('index.html')
.pipe(gap.prependFile('header.html'))
.pipe(gap.prependText(''))
.pipe(gap.appendText(''))
.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](./LICENCE).

## Disclaimer
Feel free to make changes in this README.