Failed to load my-css.component.scss

hello ionic team, I have a problem with home.scss file. I am new to Ionic, and when I try to use home.scss in home.ts like this styleUrls: [’./home.scss’] it shows me Unhandled Promise rejection: Failed to load my-css.component.scss . please help me. Thanks .

Hi!
make sure, the all files on page directory have the same name. Ionic should recognize the source of style automatically.

foo
-foo.ts
-foo.scss
-foo.html

If names are the same directive @Component look like:

@Component({
  selector: 'page-foo',
  templateUrl: 'foo.html',
})
1 Like

Hi @gropadev ,all files have same name like this
selector: ‘page-home’,
templateUrl: ‘home.html’,
styleUrls:[‘home.scss’]

Try remove “styleUrls:[‘home.scss’]” from @Componet directive. If no error, code in home.scss file should look like this:

 page-home {
       // your styles
 }
1 Like

@gropadev, if I remove styleUrls, and write styles in home.scss , will it work!!!