ether / critical
Craft CMS 的关键 CSS 生成器
0.0.1-alpha.5
2018-11-05 12:32 UTC
Requires
- ext-dom: *
- craftcms/cms: ^3.0.0-RC17
- guzzlehttp/guzzle: ^6.3.3
- ivopetkov/html5-dom-document-php: 1.*
- sabberworm/php-css-parser: ^8.1
This package is auto-updated.
Last update: 2024-09-06 09:53:15 UTC
README
Craft CMS 的关键 CSS 生成器。
用法
将 critical-css
钩子添加到您的 head 标签中
<head> {# ... #} {% hook 'critical-css' %} {# ... #} </head>
将您认为在页面上方的任何内容用折叠标签包裹
{% fold %} ... {% endfold %}
折叠标签支持 If 语句,在循环中使用标签时很有用
{% for block in entry.pageContent %} {% fold if loop.index < 2 %} ... {% endfold %} {% endfor %}
即将推出的功能
- 如果关键 CSS 中未引用字体,则排除
@font-face
。 - 能够忽略某些 CSS 文件。
- 能够清除所有关键 CSS 文件。
- 能够清除特定模板的所有关键 CSS 文件。
- 能够(重新)大量生成关键内容(循环遍历所有元素)。
- 支持所有可能的模板(产品、分类、静态页面等)。
- 选项:在页面加载时生成缺少的关键 CSS。
- 自定义关键 CSS 保存位置。