Skip to content

Commit

Permalink
docs(11ty): finally correct api.json output
Browse files Browse the repository at this point in the history
  • Loading branch information
ffoodd committed Mar 3, 2022
1 parent e02b827 commit 392d386
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions a11y.css.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@ const processSassDocumentation = file => {
}

const processApiDocumentation = file => {
const inputFileExtension = path.extname(file)
const inputFilename = path.basename(file, inputFileExtension)
const excludeFiles = ['_all']

// Exclude files that we don't want to process
if (inputFileExtension !== '.scss' || excludeFiles.includes(inputFilename)) {
return
}

const content = fs.readFileSync(file, 'utf8')
const commentBlockRegex = /\/\*doc(.)*?\*\//gs

Expand Down Expand Up @@ -174,9 +165,13 @@ const generateJsonDocumentation = () => {
processSassDocumentation(DIRECTORIES.sass.input + file)
})

let contentAPI = {}
fs.readdirSync(DIRECTORIES.api.input).forEach((file, index) => {
contentAPI[index] = processApiDocumentation(DIRECTORIES.api.input + file)
let contentAPI = []
fs.readdirSync(DIRECTORIES.api.input).forEach((file) => {
if (['_all'].includes(path.basename(file, '.scss'))) {
return
}

contentAPI = contentAPI.concat(processApiDocumentation(DIRECTORIES.api.input + file))
})

// Write Eleventy data files
Expand Down

0 comments on commit 392d386

Please sign in to comment.