purge_css
x | purge_css(safelist=?, greedy=?, blocklist=?, content=?, variables=?, important=?)A placeholder that each page’s published output replaces with the rules of the CSS (a resource or string) that page uses: the tags, classes and ids of its elements, the words of its <script> elements. safelist names (or /regex/) count as used; greedy keeps any selector whose text contains the string or matches the /regex/; blocklist names drop their selectors; content resources or strings (scripts that add classes) count their words as used on every page; variables=true drops custom properties nothing kept references; important=false drops !important. Printed compactly for the project’s browserslist targets. E.g. <style>{{ css | purge_css(content=[js]) }}</style>.
Arguments#
| Argument | Type | Required |
|---|---|---|
safelist | array | no |
greedy | array | no |
blocklist | array | no |
content | array | no |
variables | bool | no |
important | bool | no |
Details#
- Kind: Filter, implemented by fugo.
- Available in: every kind of template: layouts, partials, shortcodes and render hooks.
- Output: safe HTML, not escaped.
- Site-bound: reads the site or the page being rendered; in a component, pass
page=or declare@__nh.