<style amp-custom>
{% include "style.css" %}
</style>
我正在尝试创建一个简单的放大器站点并遇到一些问题。什么是 {% %}?它对我不起作用?
您可以尝试,它对我有用...
<style amp-custom>
@import url('css/custom.css');
</style>
您不能引用外部样式表 amp 页面,样式必须在样式标记中与amp-custom
属性
<style amp-custom>
</style>
参考:AMP样式DOC
{% include "style.css" %}
是一个树枝标签(模板(。您是否偶然在WordPress或其他PHP基本框架中?
您有两种可能性: 1.使用Inceply,您将" style.css"替换为要包含的CSS文件的" style.css"。 2.您将CSS粘贴到<style amp-custom>
中,代替模板标签(例如整个{% include "style.css" %}
(。
希望此帮助
尝试以下 - 在执行PHP脚本
执行期间包括指定的CSS文件<style amp-custom>
<?php include_once 'assets/css/all.css'; ?>
</style>
您可以将文件导入stylesheet从CSS文件中继承。 @import "file/path/the/css/or/scss/file"
之间的CC_5。完整代码在下面。
<style amp-custom>
@import "file/path/the/css/or/scss/file";
</style>
这是参考。
如果您的技术是PHP,则可以使用以下语法,并且可以使用。
<style amp-custom>
<?Php
$css = file_get_contents('/amp/assets/css/header.css');
echo $css;
?>
</style>