Plugin that adds `.taskRender` method to your Base application. Creates task with given `name` that renders glob of files using `patterns`.
MIT License
npm i base-task-render --save
For more use-cases see the tests
const baseTaskRender = require('base-task-render')
Adds
.taskRender
method to your app which makes it easier to create and run tasks which need rendering. It uses base-fs-conflicts to detect file conflicts.
Params
options
{Object}: object to merge with app.options
returns
{Function}: plugin executed by .use
methodExample
// Plugins
var fs = require('base-fs')
var tasks = require('base-task')
var render = require('assemble-render-file')
var conflicts = require('base-fs-conflicts')
var taskAlias = require('base-task-alias')
var taskRender = require('base-task-render')
// Create app
var Base = require('base')
var app = new Base()
// Load plugins
app.use(tasks())
app.use(render())
app.use(taskRender())
app.use(conflicts())
app.use(fs())
// Tasks
app.taskAlias('foo', ['bar', 'qux'])
app.taskRender('foo', '*.md')
// `.taskAlias` created `bar` and `qux` aliases
// of the `foo` task
app.build('qux', function (err) {
if (err) return console.error(err)
// => render all markdown files from `templates/` dir
// or pass `app.options.srcBase` if you want to change it
})
Creates a task with
name
to render glob ofpatterns
fromtemplates/
directory (default), or fromapp.options.srcBase
using*
engine. It also checks for file conflicts using base-fs-conflicts.
Params
name
{String}: task nameopts
{Object|Array}: options passed to .task
or array of deps
deps
{Array|String}: list of dependency taskspatterns
{Array|String}: list of patterns to pass to .src
methodreturns
{Object}: return this
instance for chainingExample
app.use(taskRender())
app.taskRender('foo', ['CONTRIBUTING.md', '*.md'])
app.build('foo', console.log)
// => will render all markdown files
// from `templates/` directory (default)
.use
and .run
methods of your Base more | homepage
.taskAlias
method to your @node-base application. Creating alias task more | homepage
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. But before doing anything, please read the CONTRIBUTING.md guidelines.