Created
July 13, 2017 13:00
-
-
Save thisislawatts/0d1672ab404c264b9900b0768799e949 to your computer and use it in GitHub Desktop.
Copy fractal components across to Shopify Theme snippets/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* */ | |
const fs = require("fs"); | |
const recursive = require("recursive-readdir"); | |
recursive(__dirname + "/src/components/", [ | |
"preview.liquid", | |
".DS_Store", | |
"*.json" | |
]).then(files => { | |
console.log(`${files.length} files will be transferred.`); | |
files.map(file => { | |
let newLocation = file | |
.split("components/") | |
.pop() | |
.replace(/\d-/, "") | |
.replace("/", "-"); | |
console.log(`${file.split(`/src/`).pop()} => snippets/${newLocation}`); | |
fs | |
.createReadStream(file) | |
.pipe(fs.createWriteStream(__dirname + "/src/snippets/" + newLocation)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment