Skip to content

Instantly share code, notes, and snippets.

@thisislawatts
Created July 13, 2017 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisislawatts/0d1672ab404c264b9900b0768799e949 to your computer and use it in GitHub Desktop.
Save thisislawatts/0d1672ab404c264b9900b0768799e949 to your computer and use it in GitHub Desktop.
Copy fractal components across to Shopify Theme snippets/
/* */
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