diff --git a/src/helpers/extractClassesFromNgClass.ts b/src/helpers/extractClassesFromNgClass.ts index 42a1609..9a8e06c 100644 --- a/src/helpers/extractClassesFromNgClass.ts +++ b/src/helpers/extractClassesFromNgClass.ts @@ -8,7 +8,7 @@ export default function extractClassesFromNgClass(value: string) { let curMatch; while ((curMatch = rxp.exec(value))) { - found.push(curMatch[1].replace(/\n/g, '').replace(/ /g, '')); + found.push(curMatch[1].replace(/[\n|\r|\t]/g, '').replace(/ /g, '')); } let classes: string[] = []; diff --git a/src/helpers/unusedClassMapper.ts b/src/helpers/unusedClassMapper.ts index ee789dc..fd67180 100644 --- a/src/helpers/unusedClassMapper.ts +++ b/src/helpers/unusedClassMapper.ts @@ -23,9 +23,10 @@ export default async function unusedClassMapper( // Try to read styling file path in order to determine if file exist fs.readFileSync(cssPath); } catch (error) { - throw new Error( + console.log( 'Styling file for component ' + htmlPath + ' not found, skipping...' ); + return [[], htmlPath]; } const classes = await findUnusedCss(htmlContent, cssPath, config);