Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tweedegolf/gulp-include-file
Include the contents of a file in javascript as a string.
https://github.com/tweedegolf/gulp-include-file
Last synced: about 2 months ago
JSON representation
Include the contents of a file in javascript as a string.
- Host: GitHub
- URL: https://github.com/tweedegolf/gulp-include-file
- Owner: tweedegolf
- License: mit
- Created: 2015-01-23T12:43:22.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-01T09:20:05.000Z (almost 9 years ago)
- Last Synced: 2024-11-17T06:16:55.393Z (2 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:```javascript
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:
```javascript
function getText() {
return "Hello world\n\nThis is a string.";
}
```Using this example gulpfile:
```javascript
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.