{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "Cecil - Assets",
  "home_page_url": "https://cecil.app/documentation/assets/",
  "feed_url": "https://cecil.app/documentation/assets/feed.json",
  "description": "Handle assets (images, stylesheets, scripts, etc.) with the asset() function: process, optimize and fingerprint them.",
  "icon": "https://cecil.app/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "favicon": "https://cecil.app/thumbnails/64x/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "language": "en",
  "items": [
    {
      "id": "https://cecil.app/documentation/assets/cdn-providers/",
      "url": "https://cecil.app/documentation/assets/cdn-providers/",
      "title": "CDN providers",
      "summary": "Configuration examples of image CDN providers (Cloudinary, Cloudimage, TwicPics, imgix, Netlify Image CDN).",
      "date_published": "2023-10-23T00:00:00+00:00",
      "date_modified": "2026-10-02T00:00:00+00:00","content_text": "CDN providers\nExamples of CDN providers configuration.\nCloudinary\nhttps:\/\/cloudinary.com\nassets:\n  images:\n    cdn:\n      enabled: true\n      account: 'xxxx'\n      url: 'https:\/\/res.cloudinary.com\/%account%\/image\/fetch\/c_limit,w_%width%,q_%quality%,f_%format%,d_default\/%image_url%'\nCloudimage\nhttps:\/\/www.cloudimage.io\nassets:\n  images:\n    cdn:\n      enabled: true\n      account: 'xxxx'\n      url: 'https:\/\/%account%.cloudimg.io\/%image_url%?w=%width%&amp;q=%quality%&amp;force_format=%format%'\nTwicPics\nhttps:\/\/www.twicpics.com\nassets:\n  images:\n    cdn:\n      enabled: true\n      account: 'xxxx'\n      canonical: false\n      remote: false\n      url: 'https:\/\/%account%.twic.pics\/%image_url%?twic=v1\/resize=%width%\/quality=%quality%\/output=%format%'\nSource URL: Your website baseurl.\nimgix\nhttps:\/\/imgix.com\nassets:\n  images:\n    cdn:\n      enabled: true\n      account: 'xxxx'\n      canonical: false\n      remote: false\n      url: 'https:\/\/%account%.imgix.net\/%image_url%?w=%width%&amp;q=%quality%&amp;fm=%format%'\nBase URL: Your website baseurl.\nNetlify Image CDN\nhttps:\/\/docs.netlify.com\/image-cdn\/overview\/\nassets:\n  images:\n    cdn:\n      enabled: true\n      canonical: false\n      url: '\/.netlify\/images?url=%image_url%&amp;w=%width%&amp;fm=%format%'\nRun locally\nSetup Netlify CLI\nnpm install netlify-cli -g\nnetlify link\nnetlify.toml:\n[dev]\n  targetPort = 8000\nRun local server\nphp cecil.phar serve &amp; netlify dev\nOpen http:\/\/localhost:8888",
      "content_html": "<h1>CDN providers</h1>\n<p>Examples of CDN providers <a href=\"../configuration/27-assets.md#assets-images-cdn\"><code translate=\"no\">configuration</code></a>.</p>\n<h2 id=\"cloudinary\">Cloudinary</h2>\n<p><a href=\"https://cloudinary.com\" target=\"_blank\" rel=\"noopener noreferrer\">https://cloudinary.com</a></p>\n<pre><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">assets:</span>\n  <span class=\"hljs-attr\">images:</span>\n    <span class=\"hljs-attr\">cdn:</span>\n      <span class=\"hljs-attr\">enabled:</span> <span class=\"hljs-literal\">true</span>\n      <span class=\"hljs-attr\">account:</span> <span class=\"hljs-string\">'xxxx'</span>\n      <span class=\"hljs-attr\">url:</span> <span class=\"hljs-string\">'https://res.cloudinary.com/%account%/image/fetch/c_limit,w_%width%,q_%quality%,f_%format%,d_default/%image_url%'</span></code></pre>\n<h2 id=\"cloudimage\">Cloudimage</h2>\n<p><a href=\"https://www.cloudimage.io\" target=\"_blank\" rel=\"noopener noreferrer\">https://www.cloudimage.io</a></p>\n<pre><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">assets:</span>\n  <span class=\"hljs-attr\">images:</span>\n    <span class=\"hljs-attr\">cdn:</span>\n      <span class=\"hljs-attr\">enabled:</span> <span class=\"hljs-literal\">true</span>\n      <span class=\"hljs-attr\">account:</span> <span class=\"hljs-string\">'xxxx'</span>\n      <span class=\"hljs-attr\">url:</span> <span class=\"hljs-string\">'https://%account%.cloudimg.io/%image_url%?w=%width%&amp;q=%quality%&amp;force_format=%format%'</span></code></pre>\n<h2 id=\"twicpics\">TwicPics</h2>\n<p><a href=\"https://www.twicpics.com\" target=\"_blank\" rel=\"noopener noreferrer\">https://www.twicpics.com</a></p>\n<pre><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">assets:</span>\n  <span class=\"hljs-attr\">images:</span>\n    <span class=\"hljs-attr\">cdn:</span>\n      <span class=\"hljs-attr\">enabled:</span> <span class=\"hljs-literal\">true</span>\n      <span class=\"hljs-attr\">account:</span> <span class=\"hljs-string\">'xxxx'</span>\n      <span class=\"hljs-attr\">canonical:</span> <span class=\"hljs-literal\">false</span>\n      <span class=\"hljs-attr\">remote:</span> <span class=\"hljs-literal\">false</span>\n      <span class=\"hljs-attr\">url:</span> <span class=\"hljs-string\">'https://%account%.twic.pics/%image_url%?twic=v1/resize=%width%/quality=%quality%/output=%format%'</span></code></pre>\n<p><code translate=\"no\">Source URL</code>: Your website <code translate=\"no\">baseurl</code>.</p>\n<h2 id=\"imgix\">imgix</h2>\n<p><a href=\"https://imgix.com\" target=\"_blank\" rel=\"noopener noreferrer\">https://imgix.com</a></p>\n<pre><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">assets:</span>\n  <span class=\"hljs-attr\">images:</span>\n    <span class=\"hljs-attr\">cdn:</span>\n      <span class=\"hljs-attr\">enabled:</span> <span class=\"hljs-literal\">true</span>\n      <span class=\"hljs-attr\">account:</span> <span class=\"hljs-string\">'xxxx'</span>\n      <span class=\"hljs-attr\">canonical:</span> <span class=\"hljs-literal\">false</span>\n      <span class=\"hljs-attr\">remote:</span> <span class=\"hljs-literal\">false</span>\n      <span class=\"hljs-attr\">url:</span> <span class=\"hljs-string\">'https://%account%.imgix.net/%image_url%?w=%width%&amp;q=%quality%&amp;fm=%format%'</span></code></pre>\n<p><code translate=\"no\">Base URL</code>: Your website <code translate=\"no\">baseurl</code>.</p>\n<h2 id=\"netlify-image-cdn\">Netlify Image CDN</h2>\n<p><a href=\"https://docs.netlify.com/image-cdn/overview/\" target=\"_blank\" rel=\"noopener noreferrer\">https://docs.netlify.com/image-cdn/overview/</a></p>\n<pre><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">assets:</span>\n  <span class=\"hljs-attr\">images:</span>\n    <span class=\"hljs-attr\">cdn:</span>\n      <span class=\"hljs-attr\">enabled:</span> <span class=\"hljs-literal\">true</span>\n      <span class=\"hljs-attr\">canonical:</span> <span class=\"hljs-literal\">false</span>\n      <span class=\"hljs-attr\">url:</span> <span class=\"hljs-string\">'/.netlify/images?url=%image_url%&amp;w=%width%&amp;fm=%format%'</span></code></pre>\n<h3 id=\"run-locally\">Run locally</h3>\n<h4>Setup Netlify CLI</h4>\n<pre><code class=\"language-bash hljs bash\" translate=\"no\">npm install netlify-cli -g\nnetlify link</code></pre>\n<p><code translate=\"no\">netlify.toml</code>:</p>\n<pre><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-string\">[dev]</span>\n  <span class=\"hljs-string\">targetPort</span> <span class=\"hljs-string\">=</span> <span class=\"hljs-number\">8000</span></code></pre>\n<h4>Run local server</h4>\n<pre><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar serve &amp; netlify dev</code></pre>\n<p>Open <a href=\"http://localhost:8888\" target=\"_blank\" rel=\"noopener noreferrer\">http://localhost:8888</a></p>",
      "language": "en"
    },
    {
      "id": "https://cecil.app/documentation/assets/images/",
      "url": "https://cecil.app/documentation/assets/images/",
      "title": "Images",
      "summary": "Resize, crop and convert images, generate responsive images and placeholders.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-10-05T00:00:00+00:00","content_text": "Images\nimage_srcset\nBuilds the HTML img srcset (responsive) attribute of an image Asset.\n{{ image_srcset(asset) }}\nExamples:\n{% set asset = asset(image_path) %}\n&lt;img src=\"{{ url(asset) }}\" width=\"{{ asset.width }}\" height=\"{{ asset.height }}\" alt=\"\" class=\"asset\" srcset=\"{{ image_srcset(asset) }}\" sizes=\"{{ image_sizes('asset') }}\"&gt;\nimage_sizes\nReturns the HTML img sizes attribute based on a CSS class name.\nIt should be use in conjunction with the image_srcset function.\n{{ image_sizes('class') }}\nExamples:\n{% set asset = asset(image_path) %}\n&lt;img src=\"{{ url(asset) }}\" width=\"{{ asset.width }}\" height=\"{{ asset.height }}\" alt=\"\" class=\"asset\" srcset=\"{{ image_srcset(asset) }}\" sizes=\"{{ image_sizes('asset') }}\"&gt;\nimage_from_website\nBuilds the HTML img element from a website URL by extracting its illustration image.\nReturns null if no image is found.\n{{ image_from_website('url', {attributes}, {options}) }}\nThe image is searched in the page HTML with the following fallbacks, the first candidate that can be downloaded as an image is used:\n\nOpen Graph: og:image:secure_url, og:image, og:image:url\nTwitter: twitter:image, twitter:image:src\n&lt;link rel=\"image_src\"&gt;\nMicrodata: itemprop=\"image\"\nJSON-LD: image property\nFirst &lt;img&gt; of &lt;article&gt;, &lt;main&gt; or &lt;body&gt;\n&lt;link rel=\"apple-touch-icon\"&gt;\n&lt;link rel=\"icon\"&gt;\n\nRelative URLs are resolved against &lt;base href&gt; or the page URL.\nThe resolved image URL and the downloaded image are cached (see cache.assets.remote.ttl).\nOptions:\n\nfallback: image path (or URL) used if no image is found\nother image options (e.g.: responsive, formats)\n\nExamples:\n{{ image_from_website('https:\/\/example.com\/page-with-image.html') }}\n\n{# with a fallback image #}\n{{ image_from_website('https:\/\/example.com\/', {alt: 'Illustration'}, {fallback: 'images\/default.png'}) }}\nresize\nResizes an image to a specified width (in pixels) or\/and height (in pixels).\n\nIf only the width is specified, the height is calculated to preserve the aspect ratio\nIf only the height is specified, the width is calculated to preserve the aspect ratio\nIf both width and height are specified, the image is resized to fit within the given dimensions, image is cropped and centered if necessary\nIf remove_animation is true, any animation in the image (e.g., GIF) will be removed\n\n{{ asset(image_path)|resize(width: width, height: height, remove_animation: bool) }}\nThe original file is not altered and the resized version is saved at \/thumbnails\/&lt;width&gt;x&lt;height&gt;\/image.jpg.\nICO files are supported: the largest icon is resized and saved as a single icon ICO file (PNG compressed). Icons stored as BMP with a color depth other than 24 or 32 bits require the Imagick PHP extension: otherwise, the original ICO file is kept and a warning is logged.\nExamples:\n{{ asset(page.image)|resize(300) }}\n{# equivalent to: #}\n{{ asset(page.image)|resize(width: 300) }}\n{# resizes to 300px width, height auto-calculated to preserve aspect ratio #}\n{{ asset(page.image)|resize(height: 200) }}\n{# resizes to 300px width and 200px height, and crops if necessary #}\n{{ asset(page.image)|resize(300, 200) }}\n{# removes any animation from the image #}\n{{ asset(page.image)|resize(width: 1200, height: 630, remove_animation: true) }}\ncover\nResizes an image to a specified width and height, cropping it if necessary.\nThe cover filter is deprecated since version 8.77 and will be removed in future versions. Use the resize filter instead, with both width and height parameters.\n{{ asset(image_path)|cover(width, height) }}\nExample:\n{{ asset(page.image)|cover(1200, 630) }}\nmaskable\nAdds padding, in pourcentages, to an image to make it maskable.\n{{ asset(image_path)|maskable(padding) }}\nExample:\n{{ asset('icon.png')|maskable }}\nwebp\nConverts an image to WebP format.\nExample:\n&lt;picture&gt;\n    &lt;source type=\"image\/webp\" srcset=\"{{ asset(image_path)|webp }}\"&gt;\n    &lt;img src=\"{{ url(asset(image_path)) }}\" width=\"{{ asset(image_path).width }}\" height=\"{{ asset(image_path).height }}\" alt=\"\"&gt;\n&lt;\/picture&gt;\navif\nConverts an image to AVIF format.\nExample:\n&lt;picture&gt;\n    &lt;source type=\"image\/avif\" srcset=\"{{ asset(image_path)|avif }}\"&gt;\n    &lt;img src=\"{{ url(asset(image_path)) }}\" width=\"{{ asset(image_path).width }}\" height=\"{{ asset(image_path).height }}\" alt=\"\"&gt;\n&lt;\/picture&gt;\nlqip\nReturns a Low Quality Image Placeholder (100x100 px, 50% blurred) as data URL.\n{{ asset(image_path)|lqip }}\ndominant_color\nReturns the dominant hexadecimal color of an image.\n{{ asset(image_path)|dominant_color }}",
      "content_html": "<h1>Images</h1>\n<h2 id=\"image-srcset\">image_srcset</h2>\n<p>Builds the HTML img <code translate=\"no\">srcset</code> (responsive) attribute of an image Asset.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ image_srcset(asset) }}</span></code></pre>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> asset = asset(image_path) %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(asset) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">width</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset.width }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">height</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset.height }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">alt</span>=<span class=\"hljs-string\">\"\"</span> <span class=\"hljs-attr\">class</span>=<span class=\"hljs-string\">\"asset\"</span> <span class=\"hljs-attr\">srcset</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ image_srcset(asset) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">sizes</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ image_sizes('asset') }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span></code></pre>\n<h2 id=\"image-sizes\">image_sizes</h2>\n<p>Returns the HTML img <code translate=\"no\">sizes</code> attribute based on a CSS class name.<br>\nIt should be use in conjunction with the <a href=\"19-images.md#image-srcset\"><code translate=\"no\">image_srcset</code></a> function.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ image_sizes('class') }}</span></code></pre>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> asset = asset(image_path) %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(asset) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">width</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset.width }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">height</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset.height }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">alt</span>=<span class=\"hljs-string\">\"\"</span> <span class=\"hljs-attr\">class</span>=<span class=\"hljs-string\">\"asset\"</span> <span class=\"hljs-attr\">srcset</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ image_srcset(asset) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">sizes</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ image_sizes('asset') }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span></code></pre>\n<h2 id=\"image-from-website\">image_from_website</h2>\n<p>Builds the HTML img element from a website URL by extracting its illustration image.\nReturns <code translate=\"no\">null</code> if no image is found.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ image_from_website('url', {attributes}, {options}) }}</span></code></pre>\n<p>The image is searched in the page HTML with the following fallbacks, the first candidate that can be downloaded as an image is used:</p>\n<ol>\n<li>Open Graph: <code translate=\"no\">og:image:secure_url</code>, <code translate=\"no\">og:image</code>, <code translate=\"no\">og:image:url</code></li>\n<li>Twitter: <code translate=\"no\">twitter:image</code>, <code translate=\"no\">twitter:image:src</code></li>\n<li><code translate=\"no\">&lt;link rel=\"image_src\"&gt;</code></li>\n<li>Microdata: <code translate=\"no\">itemprop=\"image\"</code></li>\n<li>JSON-LD: <code translate=\"no\">image</code> property</li>\n<li>First <code translate=\"no\">&lt;img&gt;</code> of <code translate=\"no\">&lt;article&gt;</code>, <code translate=\"no\">&lt;main&gt;</code> or <code translate=\"no\">&lt;body&gt;</code></li>\n<li><code translate=\"no\">&lt;link rel=\"apple-touch-icon\"&gt;</code></li>\n<li><code translate=\"no\">&lt;link rel=\"icon\"&gt;</code></li>\n</ol>\n<p>Relative URLs are resolved against <code translate=\"no\">&lt;base href&gt;</code> or the page URL.</p>\n<p>The resolved image URL and the downloaded image are cached (see <a href=\"../configuration/30-cache.md\"><code translate=\"no\">cache.assets.remote.ttl</code></a>).</p>\n<p>Options:</p>\n<ul>\n<li><code translate=\"no\">fallback</code>: image path (or URL) used if no image is found</li>\n<li>other <a href=\"../templates/reference/12-functions.md#html\"><code translate=\"no\">image</code></a> options (e.g.: <code translate=\"no\">responsive</code>, <code translate=\"no\">formats</code>)</li>\n</ul>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ image_from_website('https://example.com/page-with-image.html') }}</span><span class=\"xml\">\n\n</span><span class=\"hljs-comment\">{# with a fallback image #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ image_from_website('https://example.com/', {alt: 'Illustration'}, {fallback: 'images/default.png'}) }}</span></code></pre>\n<h2 id=\"resize\">resize</h2>\n<p>Resizes an image to a specified width (in pixels) or/and height (in pixels).</p>\n<ul>\n<li>If only the width is specified, the height is calculated to preserve the aspect ratio</li>\n<li>If only the height is specified, the width is calculated to preserve the aspect ratio</li>\n<li>If both width and height are specified, the image is resized to fit within the given dimensions, image is cropped and centered if necessary</li>\n<li>If remove_animation is true, any animation in the image (e.g., GIF) will be removed</li>\n</ul>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(image_path)|resize(width: width, height: height, remove_animation: bool) }}</span></code></pre>\n<aside class=\"note note-info\"><p>The original file is not altered and the resized version is saved at <code translate=\"no\">/thumbnails/&lt;width&gt;x&lt;height&gt;/image.jpg</code>.</p></aside>\n<aside class=\"note note-tip\"><p>ICO files are supported: the largest icon is resized and saved as a single icon ICO file (PNG compressed). Icons stored as BMP with a color depth other than 24 or 32 bits require the <a href=\"https://www.php.net/manual/book.imagick.php\" target=\"_blank\" rel=\"noopener noreferrer\">Imagick</a> PHP extension: otherwise, the original ICO file is kept and a warning is logged.</p></aside>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(page.image)|resize(300) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# equivalent to: #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ asset(page.image)|resize(width: 300) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# resizes to 300px width, height auto-calculated to preserve aspect ratio #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ asset(page.image)|resize(height: 200) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# resizes to 300px width and 200px height, and crops if necessary #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ asset(page.image)|resize(300, 200) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# removes any animation from the image #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ asset(page.image)|resize(width: 1200, height: 630, remove_animation: true) }}</span></code></pre>\n<h2 id=\"cover\">cover</h2>\n<p>Resizes an image to a specified width and height, cropping it if necessary.</p>\n<aside class=\"note note-warning\"><p>The <code translate=\"no\">cover</code> filter is deprecated since version <ins>8.77</ins> and will be removed in future versions. Use the <a href=\"#resize\"><code translate=\"no\">resize</code></a> filter instead, with both width and height parameters.</p></aside>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(image_path)|cover(width, height) }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(page.image)|cover(1200, 630) }}</span></code></pre>\n<h2 id=\"maskable\">maskable</h2>\n<p>Adds padding, in pourcentages, to an image to make it maskable.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(image_path)|maskable(padding) }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset('icon.png')|maskable }}</span></code></pre>\n<h2 id=\"webp\">webp</h2>\n<p>Converts an image to <a href=\"https://developers.google.com/speed/webp\" target=\"_blank\" rel=\"noopener noreferrer\">WebP</a> format.</p>\n<p><em>Example:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">picture</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">source</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"image/webp\"</span> <span class=\"hljs-attr\">srcset</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset(image_path)|webp }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(asset(image_path)) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">width</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset(image_path).width }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">height</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset(image_path).height }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">alt</span>=<span class=\"hljs-string\">\"\"</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">picture</span>&gt;</span></span></code></pre>\n<h2 id=\"avif\">avif</h2>\n<p>Converts an image to <a href=\"https://github.com/AOMediaCodec/libavif\" target=\"_blank\" rel=\"noopener noreferrer\">AVIF</a> format.</p>\n<p><em>Example:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">picture</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">source</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"image/avif\"</span> <span class=\"hljs-attr\">srcset</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset(image_path)|avif }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(asset(image_path)) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">width</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset(image_path).width }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">height</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ asset(image_path).height }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">alt</span>=<span class=\"hljs-string\">\"\"</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">picture</span>&gt;</span></span></code></pre>\n<h2 id=\"lqip\">lqip</h2>\n<p>Returns a <a href=\"https://www.guypo.com/introducing-lqip-low-quality-image-placeholders\" target=\"_blank\" rel=\"noopener noreferrer\">Low Quality Image Placeholder</a> (100x100 px, 50% blurred) as data URL.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(image_path)|lqip }}</span></code></pre>\n<h2 id=\"dominant-color\">dominant_color</h2>\n<p>Returns the dominant <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color\" target=\"_blank\" rel=\"noopener noreferrer\">hexadecimal color</a> of an image.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(image_path)|dominant_color }}</span></code></pre>",
      "language": "en"
    },
    {
      "id": "https://cecil.app/documentation/assets/processing/",
      "url": "https://cecil.app/documentation/assets/processing/",
      "title": "CSS, JavaScript and processing",
      "summary": "Compile Sass, minify, fingerprint, inline or embed assets.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-10-05T00:00:00+00:00","content_text": "CSS, JavaScript and processing\nfingerprint\nAdd the file content finger print to the file name.\n{{ asset(path)|fingerprint }}\n{{ path|fingerprint }}\nExamples:\n{{ asset('styles.css')|fingerprint }}\nminify\nMinifying a CSS or a JavaScript file.\n{{ asset(path)|minify }}\nExamples:\n{{ asset('styles.css')|minify }}\n{{ asset('scripts.js')|minify }}\nminify_css\nMinifying a CSS string.\n{{ variable|minify_css }}\n{% apply minify_css %}\n{# CSS here #}\n{% endapply %}\nExamples:\n{% set styles = 'some CSS here' %}\n{{ styles|minify_css }}\n&lt;style&gt;\n{% apply minify_css %}\n  html {\n    background-color: #fcfcfc;\n    color: #444;\n  }\n{% endapply %}\n&lt;\/style&gt;\nminify_js\nMinifying a JavaScript string.\n{{ variable|minify_js }}\n{% apply minify_js %}\n{# JavaScript here #}\n{% endapply %}\nExamples:\n{% set script = 'some JavaScript here' %}\n{{ script|minify_js }}\n&lt;script&gt;\n{% apply minify_js %}\n  var test = 'test';\n  console.log(test);\n{% endapply %}\n&lt;\/script&gt;\nscss_to_css\nCompiles a Sass string to CSS.\n{{ variable|scss_to_css }}\n{% apply scss_to_css %}\n{# SCSS here #}\n{% endapply %}\nAlias: sass_to_css.\nExamples:\n{% set scss = 'some SCSS here' %}\n{{ scss|scss_to_css }}\n&lt;style&gt;\n{% apply scss_to_css %}\n  $color: #fcfcfc;\n  div {\n    color: lighten($color, 20%);\n  }\n{% endapply %}\n&lt;\/style&gt;\nto_css\nCompiles a Sass file to CSS.\n{{ asset(path)|to_css }}\n{{ path|to_css }}\nExamples:\n{{ asset('styles.scss')|to_css }}\ninline\nOutputs the content of an Asset.\n{{ asset(path)|inline }}\nExample:\n{{ asset('styles.css')|inline }}\ndataurl\nReturns the data URL of an asset.\n{{ asset(path)|dataurl }}\n{{ asset(image_path)|dataurl }}",
      "content_html": "<h1>CSS, JavaScript and processing</h1>\n<h2 id=\"fingerprint\">fingerprint</h2>\n<p>Add the file content finger print to the file name.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(path)|fingerprint }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ path|fingerprint }}</span></code></pre>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset('styles.css')|fingerprint }}</span></code></pre>\n<h2 id=\"minify\">minify</h2>\n<p>Minifying a CSS or a JavaScript file.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(path)|minify }}</span></code></pre>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset('styles.css')|minify }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ asset('scripts.js')|minify }}</span></code></pre>\n<h2 id=\"minify-css\">minify_css</h2>\n<p>Minifying a CSS string.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ variable|minify_css }}</span></code></pre>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">apply</span></span> minify_css %}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# CSS here #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endapply</span></span> %}</span></code></pre>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> styles = 'some CSS here' %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ styles|minify_css }}</span></code></pre>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">apply</span></span> minify_css %}</span><span class=\"xml\"><span class=\"css\">\n  <span class=\"hljs-selector-tag\">html</span> {\n    <span class=\"hljs-attribute\">background-color</span>: <span class=\"hljs-number\">#fcfcfc</span>;\n    <span class=\"hljs-attribute\">color</span>: <span class=\"hljs-number\">#444</span>;\n  }\n</span></span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endapply</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">style</span>&gt;</span></span></code></pre>\n<h2 id=\"minify-js\">minify_js</h2>\n<p>Minifying a JavaScript string.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ variable|minify_js }}</span></code></pre>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">apply</span></span> minify_js %}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# JavaScript here #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endapply</span></span> %}</span></code></pre>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> script = 'some JavaScript here' %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ script|minify_js }}</span></code></pre>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">apply</span></span> minify_js %}</span><span class=\"xml\"><span class=\"javascript\">\n  <span class=\"hljs-keyword\">var</span> test = <span class=\"hljs-string\">'test'</span>;\n  <span class=\"hljs-built_in\">console</span>.log(test);\n</span></span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endapply</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">script</span>&gt;</span></span></code></pre>\n<h2 id=\"scss-to-css\">scss_to_css</h2>\n<p>Compiles a <a href=\"https://sass-lang.com\" target=\"_blank\" rel=\"noopener noreferrer\">Sass</a> string to CSS.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ variable|scss_to_css }}</span></code></pre>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">apply</span></span> scss_to_css %}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# SCSS here #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endapply</span></span> %}</span></code></pre>\n<p>Alias: <code translate=\"no\">sass_to_css</code>.</p>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> scss = 'some SCSS here' %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ scss|scss_to_css }}</span></code></pre>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">apply</span></span> scss_to_css %}</span><span class=\"xml\">\n  $color: #fcfcfc;\n  div {\n    color: lighten($color, 20%);\n  }\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endapply</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">style</span>&gt;</span></span></code></pre>\n<h2 id=\"to-css\">to_css</h2>\n<p>Compiles a <a href=\"https://sass-lang.com\" target=\"_blank\" rel=\"noopener noreferrer\">Sass</a> file to CSS.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(path)|to_css }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ path|to_css }}</span></code></pre>\n<p><em>Examples:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset('styles.scss')|to_css }}</span></code></pre>\n<h2 id=\"inline\">inline</h2>\n<p>Outputs the content of an <em>Asset</em>.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(path)|inline }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset('styles.css')|inline }}</span></code></pre>\n<h2 id=\"dataurl\">dataurl</h2>\n<p>Returns the <a href=\"https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\" target=\"_blank\" rel=\"noopener noreferrer\">data URL</a> of an asset.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset(path)|dataurl }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ asset(image_path)|dataurl }}</span></code></pre>",
      "language": "en"
    }
  ]
}
