将 scss 文件添加到 Stackblitz [英] Add scss file to the Stackblitz

查看:36
本文介绍了将 scss 文件添加到 Stackblitz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能告诉我如何将 scss 文件添加到 stackblitz.我试过了.但它不起作用.请查看并告诉我.

Can you tell me how to add scss file to the stackblitz. I tried that.But it is not working. Please see that and let me know.

我已尝试添加 home.html

这是项目: stackblitz

推荐答案

Scss 应该可以在 stackblitz 中工作:

@Component({
  selector: 'page-home',
  templateUrl: 'home.html',
  styleUrls: [ './home.scss' ] <== add this
})
export class HomePage {

样式类似

 page-home {
 .buttoncls {

不适用于默认封装(ViewEncapsulation.Emulated),因为 page-home 不是 home 组件模板的一部分,并且Angular 将 [_ngcontent-c0] 之类的属性添加到样式中.

won't work for you with default encapsulation(ViewEncapsulation.Emulated) because page-home is not part of home component template and angular adds attribute like [_ngcontent-c0] to styles.

所以我们可以把 page-home 改成 ion-list 看看它是怎么工作的:

So we can change page-home to ion-list and see how it works:

Stackblitz 示例(ViewEncapsulation.Emulated)

但是我们可以禁用封装:

But we can disable encapsulation:

encapsulation: ViewEncapsulation.None

Stackblitz 示例(ViewEncapsulation.None)

另请参阅此主题

https://github.com/stackblitz/core/issues/1

正如 EricSimons 9 天前评论的那样:

As EricSimons commented 9 days ago:

大家好!我们刚刚发布了 SASS 和 LESS 支持,我们还支持angular-cli.json 配置也是 :)

Hey all! We just shipped SASS and LESS support, and we also support the angular-cli.json config too :)

这篇关于将 scss 文件添加到 Stackblitz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆