Created
July 26, 2022 22:14
-
-
Save higby/0f823cd552f5dc98cba42d56057081b4 to your computer and use it in GitHub Desktop.
This file contains 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"); | |
module.exports = { | |
layout: (data) => { | |
if (data.page.outputFileExtension == "css") { | |
return null; | |
} | |
return data.layout || "base.njk"; | |
}, | |
directoryCSS: (data) => { | |
if (data.page.outputFileExtension == "css") { | |
return null; | |
} | |
let folder = data.page.inputPath.replace(/[^/]*$/, ""); | |
let slug = data.page.fileSlug || "index"; | |
if (fs.existsSync(`${folder}${slug}.scss`)) { | |
let folder = `./src${data.page.filePathStem.replace( | |
/[^/]*$/, | |
data.page.fileSlug || "index" | |
)}.scss`; | |
let collections = data.collections.all; | |
for (i = 0; i < collections.length; i += 1) { | |
if (collections[i].inputPath == folder) { | |
console.log(collections[i]); | |
return collections[i]._templateContent; | |
} | |
} | |
return "Something went wrong"; | |
} | |
return null; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment