twig/cssinliner-extension
最新稳定版本:v2.0.0
Composer 安装命令:
composer require twig/cssinliner-extension
包简介
A Twig extension to allow inlining CSS
关键字:
README 文档
README
WARNINIG: This package is deprecate; migrate to twig/cssinliner-extra instead.
This package provides a CSS inliner filter (inline_css) for Twig and a Symfony
bundle.
If you are not using Symfony, register the extension on Twig's Environment
manually:
use Twig\CssInliner\CssInlinerExtension; use Twig\Environment; $twig = new Environment(...); $twig->addExtension(new CssInlinerExtension());
Use the inline_css filter from a Twig template:
{% filter inline_css %}
<html>
<head>
<style>
p { color: red; }
</style>
</head>
<body>
<p>Hello CSS!</p>
</body>
</html>
{% endfilter %}
You can also add some stylesheets by passing them as arguments to the filter:
{% filter inline_css(source("some_styles.css"), source("another.css")) %}
<html>
<body>
<p>Hello CSS!</p>
</body>
</html>
{% endfilter %}
Styles loaded via the filter override the styles defined in the <style> tag of
the HTML document.
You can also use the filter on an included file:
{{ include('some_template.html.twig')|inline_css }}
{{ include('some_template.html.twig')|inline_css(source("some_styles.css")) }}
Note that the CSS inliner works on an entire HTML document, not a fragment.
统计信息
- 总下载量: 153.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 33
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-23