Skip to content
Snippets Groups Projects
Commit d260c3ff authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

skip .gitkeep in content folders

parent 46614b55
No related branches found
No related tags found
No related merge requests found
......@@ -2,9 +2,11 @@ const walk = require('walk')
const fs = require('fs')
const path = require('path')
module.exports = obj => {
module.exports = (obj) => {
console.log('Build step: ReadFiles')
const onFile = (root, fileStats, next, array) => {
// ignore files like .gitkeep
if (fileStats.name.startsWith('.')) return next()
const filename = path.join(root, fileStats.name)
const file = path.relative(path.join(__dirname, '..', 'content'), filename)
fs.readFile(filename, 'utf8', (err, data) => {
......@@ -22,7 +24,7 @@ module.exports = obj => {
})
}
const promise1 = new Promise(resolve => {
const promise1 = new Promise((resolve) => {
const pages = []
walk
.walk(path.join(__dirname, '..', 'content', 'articles'))
......@@ -38,7 +40,7 @@ module.exports = obj => {
})
})
const promise2 = new Promise(resolve => {
const promise2 = new Promise((resolve) => {
const redirects = []
walk
.walk(path.join(__dirname, '..', 'content', 'redirects'))
......@@ -53,8 +55,8 @@ module.exports = obj => {
resolve({ type: 'redirects', val: redirects })
})
})
return Promise.all([promise1, promise2]).then(arr => {
arr.forEach(v => {
return Promise.all([promise1, promise2]).then((arr) => {
arr.forEach((v) => {
// eslint-disable-next-line no-param-reassign
obj[v.type] = v.val
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment