繁体   English   中英

生产中的有角cli懒惰全局样式路径

[英]angular cli lazy global style path in production build

因此,如果您使用类似的配置,那么angular-cli有一种输出多个样式表的方法:

....
"styles": [
  "../styles/app.scss",
  { "input": "../styles/print.scss", "lazy": true, "output": "print" },
],
....

如果您通过--extract-css标志,这将在build dir中为dev和print.{some-hash}.bundle.css为prod生成print.bundle.css

如何在运行时在生产中加载此样式表?

我只是看不到一种获取名称的方法,可以正确创建<link>标记。

基本上,我需要用于打印和CKEditor IFrame。

您需要禁用生成的文件名中的哈希码。 为避免这种情况,请在生产版本中使用--output-hashing=media--output-hashing=none标志。

暂无
暂无

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

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