gulp-insert

WebJar for gulp-insert

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

gulp-insert
Last Version

Last Version

0.5.0
Release Date

Release Date

Type

Type

jar
Description

Description

gulp-insert
WebJar for gulp-insert
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/rschmukler/gulp-insert

Download gulp-insert

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/gulp-insert/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>gulp-insert</artifactId>
    <version>0.5.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/gulp-insert/
implementation 'org.webjars.npm:gulp-insert:0.5.0'
// https://jarcasting.com/artifacts/org.webjars.npm/gulp-insert/
implementation ("org.webjars.npm:gulp-insert:0.5.0")
'org.webjars.npm:gulp-insert:jar:0.5.0'
<dependency org="org.webjars.npm" name="gulp-insert" rev="0.5.0">
  <artifact name="gulp-insert" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='gulp-insert', version='0.5.0')
)
libraryDependencies += "org.webjars.npm" % "gulp-insert" % "0.5.0"
[org.webjars.npm/gulp-insert "0.5.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : readable-stream jar [1.0.26-4,2)
org.webjars.npm : streamqueue jar 0.0.6

Project Modules

There are no modules declared in this project.

gulp-insert

String manipulation library for gulp

Usage

npm install gulp-insert
var insert = require('gulp-insert');

Append

Appends a string onto the contents.

.pipe(insert.append('world')); // Appends 'world' to the contents of every file

Prepend

Prepends a string onto the contents.

.pipe(insert.prepend('Hello')); // Prepends 'Hello' to the contents of every file

Wrap

Wraps the contents with two strings.

.pipe(insert.wrap('Hello', 'World')); // prepends 'hello' and appends 'world' to the contents

Transform

Calls a function with the contents of the file.

.pipe(insert.transform(function(contents, file) {
  return contents.toUpperCase();
}));

Transform has access to the underlying vinyl file. The following code adds a '//' comment with the full file name before the actual content.

.pipe(insert.transform(function(contents, file) {

	var comment = '// local file: ' + file.path + '\n';
	return comment + contents;
}));

See https://github.com/wearefractal/vinyl for docmentation on the 'file' parameter.

Versions

Version
0.5.0