Skip to content

Commit

Permalink
fix: tailwindcss multiple file extension content pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin committed Apr 28, 2023
1 parent cf9811a commit a739b10
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/generators/tailwindcss.js
Expand Up @@ -92,7 +92,9 @@ module.exports = {

if (buildTemplates) {
const templateObjects = Array.isArray(buildTemplates) ? buildTemplates : [buildTemplates]
const fileTypes = get(buildTemplates, 'filetypes', 'html')
const configFileTypes = get(buildTemplates, 'filetypes', ['html'])
const fileTypes = Array.isArray(configFileTypes) ? configFileTypes : configFileTypes.split('|')
const fileTypesPattern = fileTypes.length > 1 ? `{${fileTypes.join(',')}}` : fileTypes[0]

templateObjects.forEach(template => {
const source = get(template, 'source')
Expand All @@ -101,7 +103,7 @@ module.exports = {
const sources = source(config)

if (Array.isArray(sources)) {
sources.map(s => tailwindConfig.content.files.push(`${s}/**/*.${fileTypes}`))
sources.map(s => tailwindConfig.content.files.push(`${s}/**/*.${fileTypesPattern}`))
} else if (typeof sources === 'string') {
tailwindConfig.content.files.push(sources)
}
Expand All @@ -114,7 +116,7 @@ module.exports = {

// Default behavior - directory sources as a string
else {
tailwindConfig.content.files.push(`${source}/**/*.${fileTypes}`)
tailwindConfig.content.files.push(`${source}/**/*.${fileTypesPattern}`)
}
})
}
Expand Down

0 comments on commit a739b10

Please sign in to comment.