Describe the current behavior
When specifying an extractor specific for one file type, but no extractor for the other file types in the project, I get an exception "Cannot read property 'extractor' of undefined"
To Reproduce
- use html and js as content
- add an extractor for html, but not js
- run purgecss
- see error
Expected behavior
I want the default extract to be used for any file type that I don't specify. Apparently this happened to other people previously as well: #95
Desktop (please complete the following information):
- OS: Windows (but shouldn't be related)
- Version of Purgecss: 1.1.0
Additional context
Suggested fix: in getFileExtractor() the DefaultExtractor should be returned when extractorObj is undefined
|
getFileExtractor(filename: string, extractors: Array<ExtractorsObj> = []) { |
|
if (!extractors.length) return DefaultExtractor |
|
|
|
const extractorObj: any = extractors.find(extractor => |
|
extractor.extensions.find(ext => filename.endsWith(ext)) |
|
) |
|
return extractorObj.extractor |
|
} |
Describe the current behavior
When specifying an extractor specific for one file type, but no extractor for the other file types in the project, I get an exception "Cannot read property 'extractor' of undefined"
To Reproduce
Expected behavior
I want the default extract to be used for any file type that I don't specify. Apparently this happened to other people previously as well: #95
Desktop (please complete the following information):
Additional context
Suggested fix: in getFileExtractor() the DefaultExtractor should be returned when extractorObj is undefined
purgecss/src/index.js
Lines 230 to 237 in 9b637bd