0.0.1 • Published 10 years ago

gulp-appendit v0.0.1

Weekly downloads
1
License
-
Repository
github
Last release
10 years ago

#gulp-appendit Build Status Dependency Status

appendit plugin for gulp

Appendit allows you easily to add text at a specific line. It will works with any plain text format like .txt .md .js ...

Install

npm install gulp-appendit

Usage

var gulp = require('gulp');
var appendit = require('gulp-appendit');

gulp.task('default', function() {
  gulp.src('src/index.html')
    .pipe(appendit({
     anchor: '<!-- anchor -->',
     content: [
       '<script src="script.js"></script>'
     ]
    }))
    .pipe(gulp.dest('dist'))
});

API

appendit(options)

options.anchor

Required Type: String

options.content

Required Type: Array

Example

Below is example how to use gulp-appendit:

The index.html looks like that:

<html>
	<head>
		<title></title>
		<!-- anchor -->
	</head>
	<body>
	</body>
</html>

Call the appendit function with the following parameters:

var gulp = require('gulp');
var appendit = require('gulp-appendit');

gulp.task('default', function() {
  gulp.src('index.html')
    .pipe(appendit({
     anchor: '<!-- anchor -->',
     content: [
       '<script src="main.js"></script>'
     ]
    }))
    .pipe(gulp.dest('dist'))
});

Output:

<html>
	<head>
		<title></title>
		<script src="main.js"></script>
		<!-- anchor -->
	</head>
	<body>
	</body>
</html>

License

BSD license