简体   繁体   English

从`sass`更新为`scss`

[英]updating from `sass` to `scss` in angular

when I create my angular app, I used the params as --style=sass But I would switch to scss for that again i run ng set defaults.styleExt scss and changed all files ext to .scss . 当我创建我的有角度的应用程序时,我使用的参数为--style=sass但是我将再次切换至scss ,我运行ng set defaults.styleExt scss并将所有文件扩展到.scss

But still getting error as : 但是仍然出现错误为:

ERROR in ./src/app/app.component.ts
Module not found: Error: Can't resolve './app.component.sass' in 'C:\DHL\Projects\retailApp\src\app'
ERROR in ./src/app/footer/footer.component.ts
Module not found: Error: Can't resolve './footer.component.sass' in 'C:\DHL\Projects\retailApp\src\app\footer'
ERROR in ./src/app/header/header.component.ts
Module not found: Error: Can't resolve './header.component.sass' in 'C:\DHL\Projects\retailApp\src\app\header'
ERROR in ./src/app/pages/home/home.component.ts
Module not found: Error: Can't resolve './home.component.sass' in 'C:\DHL\Projects\retailApp\src\app\pages\home'
ERROR in multi ./src/assets/css/reset.css ./src/styles.sass
Module not found: Error: Can't resolve 'C:\DHL\Projects\retailApp\src\assets\css\reset.css' in 'C:\DHL\Projects\retailApp'
ERROR in multi ./src/assets/css/reset.css ./src/styles.sass
Module not found: Error: Can't resolve 'C:\DHL\Projects\retailApp\src\styles.sass' in 'C:\DHL\Projects\retailApp'

what is the issue here? 这是什么问题? any one help me 任何人都可以帮助我

According to error, this will changed all files extension but not imports. 根据错误,这将更改所有文件扩展名,但不会更改导入。 So, you need to manually change all imports in all the components from sass to scss like this 因此,您需要像这样将所有组件中的所有导入从sass手动更改为scss

@Component({
  ........
  styleUrls: [ './marketing.component.scss' ] // change here
   ............
})

All of your files have references to SASS files. 您的所有文件都引用了SASS文件。

You need to open every file stated there, and look at the decorator of the class that will look like this 您需要打开在那里声明的每个文件,并查看如下所示的类的装饰器

@Component({
  selector: 'XX'
  templateUrl: XXX.html
  styleUrls: ['XX.sass']
})
export class XXX {}

replace sass with scss and you should be good. scss代替sass ,您应该会很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM