1.1.1 • Published 7 years ago
hoast-rename v1.1.1
hoast-rename
Rename the path of files using a specified function.
As the name suggest this is a hoast module.
Usage
Install hoast-rename using npm.
$ npm install hoast-renameParameters
engine: A function that processes the file path and returns the new one. The function should take one parameter the file path, which is of typeString. Do note the function can be asynchronous or return a promise. The function needs the return the new content in the form of a string.- Type:
Function* Required:yes
- 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:
StringorArray of strings* Required:no
- 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:
Examples
Cli
Not compatible with the CLI tool as it requires a reference to a self specified function.
Script
const Hoast = require(`hoast`);
const read = Hoast.read,
rename = require(`hoast-rename`);
Hoast(__dirname)
.use(read())
.use(rename({
engine: function(filePath) {
return filePath.substr(0, filePath.lastIndexOf(`.`)).concat(`md`);
},
patterns: `*.markdown`
}))
.process();In the example only the markdown files with the
.markdownextension are renamed to.md.
License
1.1.1
7 years ago
1.1.0
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago
1.0.0-beta.2
7 years ago
1.0.0-beta.1
7 years ago
1.0.0-beta.0
7 years ago
0.1.0
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago
0.0.0
7 years ago