{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "Cecil - Assets",
  "home_page_url": "https://cecil.app/fr/documentation/assets/",
  "feed_url": "https://cecil.app/fr/documentation/assets/feed.json",
  "description": "Manipulez les assets (images, feuilles de style, scripts, etc.) avec la fonction asset() : traitement, optimisation et empreinte.",
  "icon": "https://cecil.app/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "favicon": "https://cecil.app/thumbnails/64x/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "language": "fr",
  "items": [
    {
      "id": "https://cecil.app/fr/documentation/assets/images/",
      "url": "https://cecil.app/fr/documentation/assets/images/",
      "title": "Images",
      "summary": "Redimensionnez, recadrez et convertissez les images, générez des images responsives et des placeholders.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-10-05T00:00:00+00:00","content_text": "Images\nimage_srcset\nConstruit l'attribut HTML img srcset (responsive) d'un élément d'image.\n{{ image_srcset(asset) }}\nExemples :\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\nRenvoie l'attribut HTML img sizes basé sur un nom de classe CSS.\nIl doit être utilisé conjointement avec la fonction image_srcset.\n{{ image_sizes('class') }}\nExemples :\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\nConstruit l'élément HTML img à partir d'une URL de site Web en extrayant son image d'illustration.\nRetourne null si aucune image n'est trouvée.\n{{ image_from_website('url', {attributs}, {options}) }}\nL'image est recherchée dans le HTML de la page avec les fallbacks suivants, le premier candidat pouvant être téléchargé en tant qu'image est utilisé :\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 : propriété image\nPremière &lt;img&gt; de &lt;article&gt;, &lt;main&gt; ou &lt;body&gt;\n&lt;link rel=\"apple-touch-icon\"&gt;\n&lt;link rel=\"icon\"&gt;\n\nLes URL relatives sont résolues par rapport à &lt;base href&gt; ou à l'URL de la page.\nL'URL de l'image trouvée et l'image téléchargée sont mises en cache (voir cache.assets.remote.ttl).\nOptions :\n\nfallback : chemin (ou URL) de l'image utilisée si aucune image n'est trouvée\nautres options de image (ex. : responsive, formats)\n\nExemples :\n{{ image_from_website('https:\/\/example.com\/page-with-image.html') }}\n\n{# avec une image de fallback #}\n{{ image_from_website('https:\/\/example.com\/', {alt: 'Illustration'}, {fallback: 'images\/default.png'}) }}\nresize\nRedimensionne une image à une largeur (en pixels) ou\/et une hauteur (en pixels) spécifiée.\n\nSi seule la largeur est spécifiée, la hauteur est calculée pour conserver le rapport hauteur\/largeur\nSi seule la hauteur est spécifiée, la largeur est calculée pour conserver le rapport hauteur\/largeur\nSi la largeur et la hauteur sont spécifiées, l'image est redimensionnée pour s'adapter aux dimensions données, l'image est recadrée et centrée si nécessaire\nSi Remove_animation est vrai, toute animation dans l'image (par exemple, GIF) sera supprimée\n\n{{ asset(image_path)|resize(width: width, height: height, remove_animation: bool) }}\nLe fichier original n'est pas modifié et la version redimensionnée est enregistrée sous \/thumbnails\/&lt;width&gt;x&lt;height&gt;\/image.jpg.\nLes fichiers ICO sont supportés : la plus grande icône est redimensionnée et enregistrée dans un fichier ICO à icône unique (compressée en PNG). Les icônes stockées en BMP avec une profondeur de couleur autre que 24 ou 32 bits nécessitent l'extension PHP Imagick : à défaut, le fichier ICO original est conservé et un avertissement est journalisé.\nExemples :\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\nRedimensionne une image à une largeur et une hauteur spécifiées, en la recadrant si nécessaire.\nLe filtre cover est obsolète depuis la version 8.77 et sera supprimé dans les versions futures. Utilisez plutôt le filtre resize, avec les paramètres de largeur et de hauteur.\n{{ asset(image_path)|cover(width, height) }}\nExemple:\n{{ asset(page.image)|cover(1200, 630) }}\nmaskable\nAjoute un remplissage, en pourcentages, à une image pour la rendre masquable.\n{{ asset(image_path)|maskable(padding) }}\nExemple:\n{{ asset('icon.png')|maskable }}\nwebp\nConvertit une image au format WebP.\nExemple:\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\nConvertit une image au format AVIF.\nExemple:\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\nRenvoie un espace réservé pour une image de faible qualité (100 x 100 px, flou à 50 %) comme URL de données.\n{{ asset(image_path)|lqip }}\ndominant_color\nRenvoie la couleur hexadécimale dominante d'une image.\n{{ asset(image_path)|dominant_color }}",
      "content_html": "<h1>Images</h1>\n<h2 id=\"image-srcset\">image_srcset</h2>\n<p>Construit l'attribut HTML img <code translate=\"no\">srcset</code> (responsive) d'un élément d'image.</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>Exemples :</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>Renvoie l'attribut HTML img <code translate=\"no\">sizes</code> basé sur un nom de classe CSS.\nIl doit être utilisé conjointement avec la fonction <a href=\"19-images.fr.md#image-srcset\"><code translate=\"no\">image_srcset</code></a>.</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>Exemples :</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>Construit l'élément HTML img à partir d'une URL de site Web en extrayant son image d'illustration.\nRetourne <code translate=\"no\">null</code> si aucune image n'est trouvée.</p>\n<pre><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ image_from_website('url', {attributs}, {options}) }}</span></code></pre>\n<p>L'image est recherchée dans le HTML de la page avec les fallbacks suivants, le premier candidat pouvant être téléchargé en tant qu'image est utilisé :</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 : propriété <code translate=\"no\">image</code></li>\n<li>Première <code translate=\"no\">&lt;img&gt;</code> de <code translate=\"no\">&lt;article&gt;</code>, <code translate=\"no\">&lt;main&gt;</code> ou <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>Les URL relatives sont résolues par rapport à <code translate=\"no\">&lt;base href&gt;</code> ou à l'URL de la page.</p>\n<p>L'URL de l'image trouvée et l'image téléchargée sont mises en cache (voir <a href=\"../configuration/30-cache.fr.md\"><code translate=\"no\">cache.assets.remote.ttl</code></a>).</p>\n<p>Options :</p>\n<ul>\n<li><code translate=\"no\">fallback</code> : chemin (ou URL) de l'image utilisée si aucune image n'est trouvée</li>\n<li>autres options de <a href=\"../templates/reference/12-functions.fr.md#html\"><code translate=\"no\">image</code></a> (ex. : <code translate=\"no\">responsive</code>, <code translate=\"no\">formats</code>)</li>\n</ul>\n<p><em>Exemples :</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\">{# avec une image de fallback #}</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>Redimensionne une image à une largeur (en pixels) ou/et une hauteur (en pixels) spécifiée.</p>\n<ul>\n<li>Si seule la largeur est spécifiée, la hauteur est calculée pour conserver le rapport hauteur/largeur</li>\n<li>Si seule la hauteur est spécifiée, la largeur est calculée pour conserver le rapport hauteur/largeur</li>\n<li>Si la largeur et la hauteur sont spécifiées, l'image est redimensionnée pour s'adapter aux dimensions données, l'image est recadrée et centrée si nécessaire</li>\n<li>Si Remove_animation est vrai, toute animation dans l'image (par exemple, GIF) sera supprimée</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>Le fichier original n'est pas modifié et la version redimensionnée est enregistrée sous <code translate=\"no\">/thumbnails/&lt;width&gt;x&lt;height&gt;/image.jpg</code>.</p></aside>\n<aside class=\"note note-tip\"><p>Les fichiers ICO sont supportés : la plus grande icône est redimensionnée et enregistrée dans un fichier ICO à icône unique (compressée en PNG). Les icônes stockées en BMP avec une profondeur de couleur autre que 24 ou 32 bits nécessitent l'extension PHP <a href=\"https://www.php.net/manual/fr/book.imagick.php\" target=\"_blank\" rel=\"noopener noreferrer\">Imagick</a> : à défaut, le fichier ICO original est conservé et un avertissement est journalisé.</p></aside>\n<p><em>Exemples :</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>Redimensionne une image à une largeur et une hauteur spécifiées, en la recadrant si nécessaire.</p>\n<aside class=\"note note-warning\"><p>Le filtre <code translate=\"no\">cover</code> est obsolète depuis la version <ins>8.77</ins> et sera supprimé dans les versions futures. Utilisez plutôt le filtre <a href=\"#resize\"><code translate=\"no\">resize</code></a>, avec les paramètres de largeur et de hauteur.</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>Exemple:</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>Ajoute un remplissage, en pourcentages, à une image pour la rendre masquable.</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>Exemple:</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>Convertit une image au format <a href=\"https://developers.google.com/speed/webp\" target=\"_blank\" rel=\"noopener noreferrer\">WebP</a>.</p>\n<p><em>Exemple:</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>Convertit une image au format <a href=\"https://github.com/AOMediaCodec/libavif\" target=\"_blank\" rel=\"noopener noreferrer\">AVIF</a>.</p>\n<p><em>Exemple:</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>Renvoie un <a href=\"https://www.guypo.com/introducing-lqip-low-quality-image-placeholders\" target=\"_blank\" rel=\"noopener noreferrer\">espace réservé pour une image de faible qualité</a> (100 x 100 px, flou à 50 %) comme URL de données.</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>Renvoie la <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color\" target=\"_blank\" rel=\"noopener noreferrer\">couleur hexadécimale</a> dominante d'une 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": "fr"
    },
    {
      "id": "https://cecil.app/fr/documentation/assets/traitements/",
      "url": "https://cecil.app/fr/documentation/assets/traitements/",
      "title": "CSS, JavaScript et traitements",
      "summary": "Compilez Sass, minifiez, ajoutez une empreinte, intégrez ou embarquez les assets.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-10-05T00:00:00+00:00","content_text": "CSS, JavaScript et traitements\nfingerprint\nAjoutez l'empreinte digitale du contenu du fichier au nom du fichier.\n{{ asset(path)|fingerprint }}\n{{ path|fingerprint }}\nExemples :\n{{ asset('styles.css')|fingerprint }}\nminify\nRéduire un fichier CSS ou JavaScript.\n{{ asset(path)|minify }}\nExemples :\n{{ asset('styles.css')|minify }}\n{{ asset('scripts.js')|minify }}\nminify_css\nRéduire une chaîne CSS.\n{{ variable|minify_css }}\n{% apply minify_css %}\n{# CSS here #}\n{% endapply %}\nExemples :\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\nRéduire une chaîne JavaScript.\n{{ variable|minify_js }}\n{% apply minify_js %}\n{# JavaScript here #}\n{% endapply %}\nExemples :\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\nCompile une chaîne Sass en CSS.\n{{ variable|scss_to_css }}\n{% apply scss_to_css %}\n{# SCSS here #}\n{% endapply %}\nAlias : sass_to_css.\nExemples :\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\nCompile un fichier Sass en CSS.\n{{ asset(path)|to_css }}\n{{ path|to_css }}\nExemples :\n{{ asset('styles.scss')|to_css }}\ninline\nAffiche le contenu d'un Asset.\n{{ asset(path)|inline }}\nExemple:\n{{ asset('styles.css')|inline }}\ndataurl\nRenvoie l'URL de données d'un actif.\n{{ asset(path)|dataurl }}\n{{ asset(image_path)|dataurl }}",
      "content_html": "<h1>CSS, JavaScript et traitements</h1>\n<h2 id=\"fingerprint\">fingerprint</h2>\n<p>Ajoutez l'empreinte digitale du contenu du fichier au nom du fichier.</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>Exemples :</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>Réduire un fichier CSS ou JavaScript.</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>Exemples :</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>Réduire une chaîne CSS.</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>Exemples :</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>Réduire une chaîne JavaScript.</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>Exemples :</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>Compile une chaîne <a href=\"https://sass-lang.com\" target=\"_blank\" rel=\"noopener noreferrer\">Sass</a> en 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>Exemples :</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>Compile un fichier <a href=\"https://sass-lang.com\" target=\"_blank\" rel=\"noopener noreferrer\">Sass</a> en 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>Exemples :</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>Affiche le contenu d'un <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>Exemple:</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>Renvoie l'<a href=\"https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\" target=\"_blank\" rel=\"noopener noreferrer\">URL de données</a> d'un actif.</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": "fr"
    },
    {
      "id": "https://cecil.app/fr/documentation/assets/fournisseurs-cdn/",
      "url": "https://cecil.app/fr/documentation/assets/fournisseurs-cdn/",
      "title": "Fournisseurs de CDN",
      "summary": "Exemples de configuration de fournisseurs de CDN d’images (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": "Fournisseurs de CDN\nExemples de configuration de fournisseurs de CDN pour les options de 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 : URL de base de votre site.\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 : URL de base de votre site.\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%'\nExécution en local\nInstaller Netlify CLI\nnpm install netlify-cli -g\nnetlify link\nnetlify.toml :\n[dev]\n  targetPort = 8000\nDémarrer le serveur local\nphp cecil.phar serve &amp; netlify dev\nOuvrez http:\/\/localhost:8888",
      "content_html": "<h1>Fournisseurs de CDN</h1>\n<p>Exemples de configuration de fournisseurs de CDN pour les <a href=\"../configuration/27-assets.fr.md#assets-images-cdn\"><code translate=\"no\">options de 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> : URL de base de votre site.</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> : URL de base de votre site.</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=\"execution-en-local\">Exécution en local</h3>\n<h4>Installer 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>Démarrer le serveur local</h4>\n<pre><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar serve &amp; netlify dev</code></pre>\n<p>Ouvrez <a href=\"http://localhost:8888\" target=\"_blank\" rel=\"noopener noreferrer\">http://localhost:8888</a></p>",
      "language": "fr"
    }
  ]
}
