0.0.19 • Published 8 years ago

gulp-inject-file v0.0.19

Weekly downloads
569
License
MIT
Repository
github
Last release
8 years ago

gulp-inject-file NPM version Build Status Dependency Status

File inject plugin for gulp.

gulp-inject-file takes a stream of source files, and replaces inject pattern with contents of the referenced file.

Installation

Install gulp-inject as a development dependency:

npm install --save-dev gulp-inject-file

Usage

Project structure:

└── src
    └── main.xml
        └── subitems
            └── child.xml

The target file src/main.xml:

<?xml version="1.0" encoding="UTF-8"?>
<one>
    <!-- inject: ./subitems/child.xml-->
</one>

The child file src/subitems/child.xml:

<child_record></child_record>

The gulpfile.js:

var gulp = require('gulp');
var injectfile = require("gulp-inject-file");

gulp.task('inject', function () {
    return gulp.src('./src/main.xml')
                .pipe(injectfile({
                    // can use custom regex pattern here
                    // <filename> token will be replaced by filename regex pattern.
					// do not use capturing groups within your custom regex.
                    // this parameter is optional, default value: '<!--\\s*inject:<filename>-->'
                    pattern: '<!--\\s*inject:<filename>-->'
                }));
});

src/main.xml after running gulp inject:

<?xml version="1.0" encoding="UTF-8"?>
<one>
    <child_record></child_record>
</one>

The injected file paths are relative to each source file's cwd.

License

MIT License

0.0.19

8 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.1

10 years ago