Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/truemedia/stream-render-pipeline
File generation strategy for working with creating/modifying files using gulp
https://github.com/truemedia/stream-render-pipeline
Last synced: 1 day ago
JSON representation
File generation strategy for working with creating/modifying files using gulp
- Host: GitHub
- URL: https://github.com/truemedia/stream-render-pipeline
- Owner: Truemedia
- License: mit
- Created: 2019-01-20T13:09:16.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-20T18:06:52.000Z (almost 6 years ago)
- Last Synced: 2024-04-23T21:28:59.311Z (7 months ago)
- Language: JavaScript
- Size: 38.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stream render pipeline
File generation strategy for working with creating/modifying files using gulp## Installation
```bash
npm i stream-render-pipeline
```## Usage
### Creating a render pipeline (./pipes/text.js)
```js
const lazypipe = require('lazypipe');
const gulpPlugins = require('auto-plug')('gulp');
const File = require('stream-render-pipeline');
module.exports = class TextFile extends File
{
construct(opts)
{
super(opts)
}get render()
{
let {foo} = this.data;return lazypipe()
.pipe(gulpPlugins.addSrc, this.tplPath(__dirname, '*.txt')) // Template file
.pipe(gulpPlugins.template, {foo}); // Templating
}
}
```### Creating a generator function
```js
const {dest} = require('gulp');
const inquirer = require('inquirer');
const TextFile = require('./pipes/text');/**
* Generate text file
*/
module.exports = function text()
{
let defaults = {
foo: 'bar'
};
return inquirer.prompt([
// Questions
]).then(answers => {
let build = {...defaults, ...answers};
new TextFile(build).render().pipe( dest('./src') )
});
}
```### Running render pipeline
```bash
gulp text
```## Structure
- */pipes*
- */presets*
- */questions*
- */templates*