Transform the content of files based on the extension.
As the name suggest this is a hoast module. The module has been based of metalsmith-in-place.
Install hoast-transform using npm.
$ npm install hoast-transform
options
: Options given to the JSTransformer.- Type:
Object
- Default:
{}
- Default:
- Type:
patterns
: Glob patterns to match file paths with. If the engine function is set it will only give the function any files matching the pattern.- Type:
String
orArray of strings
- Required:
no
- Required:
- Type:
patternOptions
: Options for the glob pattern matching. See planckmatch options for more details on the pattern options.- Type:
Object
- Default:
{}
- Type:
patternOptions.all
: This options is added topatternOptions
, and determines whether all patterns need to match instead of only one.- Type:
Boolean
- Default:
false
- Type:
CLI
{
"modules": {
"read": {},
"hoast-transform": {
"patterns": "*.md"
}
}
}
Script
const Hoast = require(`hoast`);
const read = Hoast.read,
transform = require(`hoast-transform`);
Hoast(__dirname)
.use(read())
.use(transform({
patterns: `*.md`
}))
.process();
In the examples the markdown files will be transformed to HTML.
If you are having problems with the module please enable debugging to have a closer look.
File not valid for processing.
- The file is not utf-8 encoded.
- The file path does not match any of the patterns.
No valid transformer found for extension .
- Check if the JSTransformer associated with the extension is installed.