magical-move
v0.3.1
Published
mv with data replacement.
Downloads
16
Readme
magical-move
mv with data replacement.
If you wanna copy and parse content, use mem-fs-editor instead.
Install
$ npm install --save magical-move
Usage
const move = require('magical-move')
/** source.js, in nunjucks template syntax:
hello {{ name }}
*/
async function main() {
await move('./source.js', './output.js', {name: 'egoist'})
}
/** output.js:
hello egoist
*/
CLI
Install
$ npm install -g magical-move
Usage
# same result as above
$ move source.js output.js --name egoist
API
move(from, to, [data, nunjucksOptions])
from String
source file
to String
output file
data Object
The data to render template
nunjucksOptions https://mozilla.github.io/nunjucks/api.html#configure
move.sync
Same options but synchronously.
License
MIT © EGOIST