base-task-render

Plugin that adds `.taskRender` method to your Base application. Creates task with given `name` that renders glob of files using `patterns`.

MIT License

Downloads
12
Stars
2
Committers
2

base-task-render npmjs.com The MIT License npm downloads

Install

npm i base-task-render --save

Usage

For more use-cases see the tests

const baseTaskRender = require('base-task-render')

baseTaskAlias

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 method

Example

// 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
})

.taskRender

Creates a task with name to render glob of patterns from templates/ directory (default), or from app.options.srcBase using * engine. It also checks for file conflicts using base-fs-conflicts.

Params

  • name {String}: task name
  • opts {Object|Array}: options passed to .task or array of deps
  • deps {Array|String}: list of dependency tasks
  • patterns {Array|String}: list of patterns to pass to .src method
  • returns {Object}: return this instance for chaining

Example

app.use(taskRender())

app.taskRender('foo', ['CONTRIBUTING.md', '*.md'])
app.build('foo', console.log)
// => will render all markdown files
// from `templates/` directory (default)

Related

Contributing

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.

Charlike Make Reagent new message to charlike freenode #charlike

Package Rankings
Top 23.02% on Npmjs.org
Badges
Extracted from project README
npmjs.com The MIT License npm downloads code climate standard code style travis build status coverage status dependency status new message to charlike freenode #charlike tunnckoCore.tk keybase tunnckoCore tunnckoCore npm tunnckoCore twitter tunnckoCore github
Related Projects