ngx-unused-css icon indicating copy to clipboard operation
ngx-unused-css copied to clipboard

Parser doesn't find the basic src/app/app.component.scss file

Open leomayer opened this issue 2 years ago • 3 comments

I try to run npm run unused-css and get as a response

> [email protected] unused-css
> ngx-unused-css

e Error: Styling file for component src/app/app.component.html not found, skipping...
    at /home.local/lw/workspace-my-app-ng/my-app-frontend/node_modules/ngx-unused-css/dist/src/helpers/unusedClassMapper.js:25:31
    at step (/home.local/lw/workspace-my-app-ng/my-app-frontend/node_modules/tslib/tslib.js:144:27)
    at Object.next (/home.local/lw/workspace-my-app-ng/my-app-frontend/node_modules/tslib/tslib.js:125:57)
    at /home.local/lw/workspace-my-app-ng/my-app-frontend/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at __awaiter (/home.local/lw/workspace-my-app-ng/my-app-frontend/node_modules/tslib/tslib.js:114:16)
    at unusedClassMapper (/home.local/lw/workspace-my-app-ng/my-app-frontend/node_modules/ngx-unused-css/dist/src/helpers/unusedClassMapper.js:15:34)
    at /home.local/lw/workspace-my-app-ng/my-app-frontend/node_modules/ngx-unused-css/dist/src/main/getUnusedClasses.js:48:52
    at Array.map (<anonymous>)
    at UnusedClasses.mapClasses (/home.local/lw/workspace-my-app-ng/my-app-frontend/node_modules/ngx-unused-css/dist/src/main/getUnusedClasses.js:42:33) /home.local/lw/workspace-my-app-ng/my-app-frontend
Error: Error: Error: Styling file for component src/app/app.component.html not found, skipping...
    at /home.local/lw/workspace-my-app-ng/my-app-frontend/node_modules/ngx-unused-css/dist/src/main.js:33:23

Running the command ll src/app/app.component.* I get

-rw-rw-r-- 1 lw users  167 22. Jun 2020  src/app/app.component.html
-rw-rw-r-- 1 lw users    0 26. Nov 2018  src/app/app.component.scss
-rw-r--r-- 1 lw users 1,1K 26. Nov 2020  src/app/app.component.spec.ts
-rw-rw-r-- 1 lw users  397 30. Mai 10:44 src/app/app.component.ts

The .ngx-unused-css.json

{
  "path": "src/app",
  "ignore": [
    ".mat-"
  ],
  "cli": true,
  "globalStyles": "src/styles.scss",
  "styleExt": ".scss"
}

leomayer avatar May 30 '22 09:05 leomayer

The default file extension is .scss but the required format is scss! Therefore it cannot find a file with component..scss

leomayer avatar May 30 '22 15:05 leomayer

I'm having the same issue... @ivanblazevic - Are you still maintaining this library?

Mike-Becatti avatar Feb 23 '23 20:02 Mike-Becatti

Change the line 6 on .ngx-unused-css.json

...
"styleExt": ".scss"
...

To:

...
"styleExt": "scss"
...

ruanitto avatar Apr 05 '23 19:04 ruanitto