🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

gulp-include-file

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-include-file

Include the contents of a file in javascript as a string.

Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

gulp-include-file

Include the contents of a file inside a javascript file. This module will read the contents of the file specified and then create a javascript string which will be injected at the place specified.

Install

npm install gulp-include-file

Example

Given the following javascript file:

function getText() {
  return INCLUDE_FILE("example.txt");
}

And the following example.txt in the same directory:

Hello world!

This is a string.

This module will generate the following file:

function getText() {
  return "Hello world\n\nThis is a string.";
}

Using this example gulpfile:

var gulp = require('gulp');
var include_file = require('gulp-include-file');

gulp.task('example', function () {
  gulp.src('./src/scripts/**/*.js')
    .pipe(include_file())
    .pipe(gulp.dest('./dist'));
});

Options

  • regex: The regex to use instead of the default one.
  • transform: The transform function to use instead of the default one.

License

This module is released under the MIT license.

Keywords

gulp

FAQs

Package last updated on 23 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts