task-registry-file-layout
v0.1.0
Published
The task will apply a layout to the file contents.
Downloads
3
Maintainers
Readme
task-registry-file-layout
- Apply a layout to the file contents.
- Register a layout to the system.
- add the layout search path for directory.
Usage
Task = require 'task-registry'
require 'task-registry-file-layout'
layout = Task 'layout'
# register the layout as 'main' layout
# the name is optional, the file base name is the name if no name.
layout.executeSync path: 'main.layout', isDefaultLayout: true, overwrite: true
# apply the layout to the file contents.
# the layout could be a name or a file path.
layout.executeSync path: 'hi.md', layout: 'main'
API
executeSync(aFile)
orexecute(aFile, done)
:- the
aFile
should be a json object or the File object.path
String: the file path- apply the layout to the file contents
layout
String: apply the layout to the file
- the file contents as a layout to register
name
String: the layout name to register (optional). the file basename is the layout name unless exists.isDefaultLayout
Boolean: whether this is the default layout. defaults to false.overwrite
Boolean: whether overwrite if the layout name has already exists. defaults to false.layoutBase
String: this layoutBase will wrap(nest) the layout.layoutTag
String: the name of the placeholder tag. defaults to 'body'layoutDelims
Array of String|Regex: the placeholder delimiters to use. This can be a regex, like/\{{([^}]+)\}}/
, or an array of delimiter strings, like['{{', '}}']
. defaults to{% body %}
is used as the placeholder (insertion point) for content.
- the
TODO
License
MIT