I'm not sure whether this is possible in a single line, but I want to run yaml2json and pass the result json to jade -O option in CLI.
I know if I write the json file and specify the output file path in -O
option, it works. But I would rather not write some temporary file if this can be done without it.
So This works
{
"scripts": {
"jade": "yaml2json src/data/site.yaml > temp.json && jade src/jade/pages --out dist -O temp.json",
}
}
However this doesn't.
{
"scripts": {
"jade": "jade src/jade/pages --out dist -O yaml2json src/data/site.yaml"
}
}
Any help or insight would be appreciated.
Have you tried using backticks (the grave)?
{
"scripts": {
"jade": "jade src/jade/pages --out dist -O \"`yaml2json src/data/site.yaml`\""
}
}
Or you could remove the temporary file afterwards if it is lingering (Linux/OSX only):
{
"scripts": {
"jade": "yaml2json src/data/site.yaml > temp.json && jade src/jade/pages --out dist -O temp.json && rm temp.json",
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.