【问题标题】:Is there any way to get compiled CSS of angular2+ component有什么办法可以得到 angular2+ 组件的编译 CSS
【发布时间】:2022-01-26 05:12:55
【问题描述】:

有什么方法可以得到 angular2+ 组件的编译 CSS(作为字符串)?

@Component({
  selector: 'test-graph',
  templateUrl: './test-graph.component.html',
  styleUrls: ['./test-graph.component.scss']
})
export class TestGraphComponent implements OnInit {
}

正在寻找一些方法/实用程序来获取在“test-graph.component.scss”中定义的 css。

【问题讨论】:

    标签: css angular


    【解决方案1】:

    命令行:sass source/stylesheets/index.scss build/stylesheets/index.css

    更多关于 sass here

    【讨论】:

    • 我试过但没用。我需要它作为字符串,所以我可以导出它。
    • 你想在运行时编译scss文件并获取css值以便通过js动态使用?
    • 是的,我可以通过组件工厂解析器获取 html,但缺少 CSS。
    猜你喜欢
    • 2011-01-19
    • 2013-01-04
    • 2021-11-22
    • 1970-01-01
    • 2011-11-14
    • 2017-08-18
    • 2020-02-13
    • 1970-01-01
    相关资源
    最近更新 更多