<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  
  <title>Eleventy Quick Tips</title>
  <subtitle>All of the official Eleventy Quick Tips, in feed form.</subtitle>
  <link href="https://www.11ty.dev/docs/quicktips/feed.xml" rel="self" />
  <link href="https://www.11ty.dev/" />
  <updated>2023-01-24T06:00:00Z</updated>
  <id>https://www.11ty.dev/</id>
  <author>
    <name>Zach Leatherman</name>
  </author>
  <entry>
    <title>Quick Tip: Draft Posts using Computed Data</title>
    <link href="https://www.11ty.dev/docs/quicktips/draft-posts/" />
    <updated>2023-01-24T06:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/draft-posts/</id>
    <content type="html">&lt;p&gt;This example has been simplified and &lt;a href=&quot;https://www.11ty.dev/docs/config-preprocessors/#example-drafts&quot;&gt;moved to the &lt;code&gt;addPreprocessor&lt;/code&gt; documentation page&lt;/a&gt;. You can view the previous version of this page on the &lt;a href=&quot;https://v2.11ty.dev/docs/quicktips/draft-posts/&quot;&gt;&lt;code&gt;v2&lt;/code&gt; documentation&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Quick Tip: Use local plugins to reduce config file size</title>
    <link href="https://www.11ty.dev/docs/quicktips/local-plugin/" />
    <updated>2022-02-20T06:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/local-plugin/</id>
    <content type="html">&lt;p&gt;Is your &lt;code&gt;.eleventy.js&lt;/code&gt; file getting too large? You can &lt;a href=&quot;https://www.11ty.dev/docs/plugins/#creating-a-plugin&quot;&gt;create your own plugin&lt;/a&gt; to move some code out.&lt;/p&gt;
&lt;p&gt;First, create a plugin file. We recommend creating a &lt;code&gt;config&lt;/code&gt; or &lt;code&gt;_config&lt;/code&gt; folder in your project to store config files in. Make sure that folder isn’t getting copied out to your built site (via &lt;a href=&quot;https://www.11ty.dev/docs/ignores/&quot;&gt;ignores&lt;/a&gt;). Then create a file in that folder. It doesn’t matter what you name it.&lt;/p&gt;
&lt;div class=&quot;codetitle codetitle-right-md&quot;&gt;config/local-plugin.js&lt;/div&gt;
&lt;is-land on:visible import=&quot;/js/seven-minute-tabs.js&quot;&gt;
&lt;seven-minute-tabs class=&quot;tabs-flush&quot; persist sync autoheight&gt;
&lt;div role=&quot;tablist&quot; aria-label=&quot;Template Language Chooser&quot;&gt;
	&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/local-plugin/#tab-id-8-jsesm&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jsesm&quot;&gt;ESM&lt;/a&gt;
&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/local-plugin/#tab-id-8-jscjs&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jscjs&quot;&gt;CommonJS&lt;/a&gt;
&lt;/div&gt;
  &lt;div id=&quot;tab-id-8-jsesm&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-17&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-17&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;eleventyConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;// Move any code from `eleventy.config.js` here.&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;// Use eleventyConfig as you would in your top-level config file&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;tab-id-8-jscjs&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-18&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-18&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;eleventyConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;// Move any code from `eleventy.config.js` here.&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;// Use eleventyConfig as you would in your top-level config file&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/seven-minute-tabs&gt;
&lt;/is-land&gt;
&lt;div class=&quot;elv-callout elv-callout-info&quot;&gt;&lt;div class=&quot;elv-callout-c&quot;&gt;Any variables defined in your &lt;code&gt;eleventy.config.js&lt;/code&gt; file will &lt;em&gt;not&lt;/em&gt; be available to your plugin. Consider moving those variables into your plugin file, or &lt;a href=&quot;https://www.11ty.dev/docs/plugins/#plugin-configuration-options&quot;&gt;passing them in as options&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Next, use the &lt;code&gt;addPlugin&lt;/code&gt; method:&lt;/p&gt;
&lt;div class=&quot;codetitle codetitle-right-md&quot;&gt;eleventy.config.js&lt;/div&gt;
&lt;is-land on:visible import=&quot;/js/seven-minute-tabs.js&quot;&gt;
&lt;seven-minute-tabs class=&quot;tabs-flush&quot; persist sync autoheight&gt;
&lt;div role=&quot;tablist&quot; aria-label=&quot;Template Language Chooser&quot;&gt;
	&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/local-plugin/#tab-id-9-jsesm&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jsesm&quot;&gt;ESM&lt;/a&gt;
&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/local-plugin/#tab-id-9-jscjs&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jscjs&quot;&gt;CommonJS&lt;/a&gt;
&lt;/div&gt;
  &lt;div id=&quot;tab-id-9-jsesm&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-19&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-19&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; localPlugin &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./config/local-plugin.js&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;eleventyConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addPlugin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;localPlugin&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;tab-id-9-jscjs&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-20&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-20&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; localPlugin &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;./config/local-plugin.js&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;eleventyConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addPlugin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;localPlugin&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/seven-minute-tabs&gt;
&lt;/is-land&gt;</content>
  </entry>
  <entry>
    <title>Quick Tip: Transform Global Data using an `eleventyComputed.js` Global Data File</title>
    <link href="https://www.11ty.dev/docs/quicktips/create-multiple-computed-data-elements/" />
    <updated>2020-11-01T05:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/create-multiple-computed-data-elements/</id>
    <content type="html">&lt;p&gt;You can generate multiple data cascade elements in one &lt;code&gt;eleventyComputed.js&lt;/code&gt; file. Following is a working example.&lt;/p&gt;
&lt;p&gt;This example generates data cascade elements from multiple &lt;code&gt;.json&lt;/code&gt; files in the global data directory.&lt;/p&gt;
&lt;p&gt;Assume you have data files named &lt;code&gt;links.json&lt;/code&gt; and &lt;code&gt;copyrights.json&lt;/code&gt;, and you only want to extract a portion of the json object. In this case, the &lt;code&gt;entry&lt;/code&gt; element contains the useful data in the json object, and is a child of the &lt;code&gt;feed&lt;/code&gt; element in this case.&lt;/p&gt;
&lt;p&gt;The corresponding &lt;code&gt;eleventyComputed.js&lt;/code&gt; file contents can look like the following:&lt;/p&gt;
&lt;div class=&quot;codetitle codetitle-right-md&quot;&gt;_data/eleventyComputed.js&lt;/div&gt;
&lt;is-land on:visible import=&quot;/js/seven-minute-tabs.js&quot;&gt;
&lt;seven-minute-tabs class=&quot;tabs-flush&quot; persist sync autoheight&gt;
&lt;div role=&quot;tablist&quot; aria-label=&quot;Template Language Chooser&quot;&gt;
	&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/create-multiple-computed-data-elements/#tab-id-3-jsesm&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jsesm&quot;&gt;ESM&lt;/a&gt;
&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/create-multiple-computed-data-elements/#tab-id-3-jscjs&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jscjs&quot;&gt;CommonJS&lt;/a&gt;
&lt;/div&gt;
  &lt;div id=&quot;tab-id-3-jsesm&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-7&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-7&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token function-variable function&quot;&gt;myCopyrights&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;copyrights&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;feed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;entry&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;token function-variable function&quot;&gt;myLinks&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;links&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;feed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;entry&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;tab-id-3-jscjs&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-8&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-8&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;exports &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token function-variable function&quot;&gt;myCopyrights&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;copyrights&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;feed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;entry&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;token function-variable function&quot;&gt;myLinks&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;links&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;feed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;entry&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/seven-minute-tabs&gt;
&lt;/is-land&gt;</content>
  </entry>
  <entry>
    <title>Quick Tip: Cache Data Requests</title>
    <link href="https://www.11ty.dev/docs/quicktips/cache-api-requests/" />
    <updated>2020-04-23T05:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/cache-api-requests/</id>
    <content type="html">&lt;div class=&quot;elv-callout elv-callout-info&quot;&gt;&lt;div class=&quot;elv-callout-c&quot;&gt;
Read the full &lt;a href=&quot;https://www.11ty.dev/docs/plugins/fetch/&quot;&gt;documentation at the &lt;code&gt;eleventy-fetch&lt;/code&gt; plugin page&lt;/a&gt;.
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In &lt;a href=&quot;https://www.11ty.dev/docs/quicktips/eliminate-js/&quot;&gt;Quick Tip #007&lt;/a&gt;, we described a method to fetch data from an API at build time (in this example it was GitHub Stargazers) to display on your site.&lt;/p&gt;
&lt;p&gt;However, if you’re working on your site locally, you probably don’t want every Eleventy build to make a request to an external API call. You’d hit the rate limit pretty quickly (on GitHub, 60 per hour) and each request would slow down your build times!&lt;/p&gt;
&lt;p&gt;Now there is an easier way. You can use the &lt;a href=&quot;https://www.11ty.dev/docs/plugins/fetch/&quot;&gt;&lt;code&gt;eleventy-fetch&lt;/code&gt;&lt;/a&gt; utility to cache these requests to save on both API limits and build performance!&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;npm install @11ty/eleventy-fetch&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;features&quot;&gt;Features&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Makes at most one network request in the &lt;code&gt;duration&lt;/code&gt; time span—save on both your API limit count and your build time!&lt;/li&gt;
&lt;li&gt;Easy graceful handling of bad network requests to an API.&lt;/li&gt;
&lt;li&gt;If your cache expires and it makes another request, and that request fails—it automatically falls back to the expired cache entry! This is especially useful if you’re developing without a network connection (airplane-driven-development)—your site will work the same as it did with the network connection—no changes required to your local development environment.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;example&quot;&gt;Example&lt;/h2&gt;
&lt;p&gt;This code is currently in use on the Eleventy web site to display GitHub stars in the footer. Check out the &lt;a href=&quot;https://github.com/11ty/11ty-website/blob/768b97fb27543e3139fe53dfb19cdeafb12e3d1c/_data/github.js&quot;&gt;full source code&lt;/a&gt;.&lt;/p&gt;
&lt;is-land on:visible import=&quot;/js/seven-minute-tabs.js&quot;&gt;
&lt;seven-minute-tabs class=&quot;tabs-flush&quot; persist sync autoheight&gt;
&lt;div role=&quot;tablist&quot; aria-label=&quot;Template Language Chooser&quot;&gt;
	&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/cache-api-requests/#tab-id-1-jsesm&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jsesm&quot;&gt;ESM&lt;/a&gt;
&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/cache-api-requests/#tab-id-1-jscjs&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jscjs&quot;&gt;CommonJS&lt;/a&gt;
&lt;/div&gt;
  &lt;div id=&quot;tab-id-1-jsesm&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-3&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-3&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; Fetch &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;@11ty/eleventy-fetch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;// https://developer.github.com/v3/repos/#get&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; json &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;https://api.github.com/repos/11ty/eleventy&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token literal-property property&quot;&gt;duration&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1d&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// 1 day&lt;/span&gt;
		&lt;span class=&quot;token literal-property property&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;json&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// also supports &quot;text&quot; or &quot;buffer&quot;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token literal-property property&quot;&gt;stargazers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; json&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;stargazers_count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;tab-id-1-jscjs&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-4&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-4&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; Fetch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;@11ty/eleventy-fetch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;// https://developer.github.com/v3/repos/#get&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; json &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;https://api.github.com/repos/11ty/eleventy&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token literal-property property&quot;&gt;duration&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1d&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// 1 day&lt;/span&gt;
		&lt;span class=&quot;token literal-property property&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;json&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// also supports &quot;text&quot; or &quot;buffer&quot;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token literal-property property&quot;&gt;stargazers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; json&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;stargazers_count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/seven-minute-tabs&gt;
&lt;/is-land&gt;
&lt;div class=&quot;elv-callout elv-callout-info&quot;&gt;&lt;div class=&quot;elv-callout-c&quot;&gt;&lt;p&gt;Take note that if you’re using this on a hosted build server, it may not maintain updates to the cache and will likely re-run every time. You can learn how to &lt;a href=&quot;https://www.11ty.dev/docs/deployment/#persisting-cache&quot;&gt;&lt;strong&gt;persist this cache&lt;/strong&gt; on your build server&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Otherwise, current &lt;a href=&quot;https://developer.github.com/v3/#rate-limiting&quot;&gt;GitHub rate limits&lt;/a&gt; are limited to 60 requests per hour, so this will only be a problem if you do more than 60 Netlify builds in an hour. The &lt;a href=&quot;https://blog.npmjs.org/post/164799520460/api-rate-limiting-rolling-out&quot;&gt;npm API doesn’t seem to have a hard limit&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;failing-even-more-gracefully&quot;&gt;Failing Even More Gracefully&lt;/h3&gt;
&lt;p&gt;Wrap the above code in a nice &lt;code&gt;try catch&lt;/code&gt; allows you to return a fake data set if the very first request fails (no expired cache entry is available). &lt;strong&gt;Note that if there is already an expired cache entry available, we use that instead.&lt;/strong&gt;&lt;/p&gt;
&lt;is-land on:visible import=&quot;/js/seven-minute-tabs.js&quot;&gt;
&lt;seven-minute-tabs class=&quot;tabs-flush&quot; persist sync autoheight&gt;
&lt;div role=&quot;tablist&quot; aria-label=&quot;Template Language Chooser&quot;&gt;
	&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/cache-api-requests/#tab-id-2-jsesm&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jsesm&quot;&gt;ESM&lt;/a&gt;
&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/cache-api-requests/#tab-id-2-jscjs&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jscjs&quot;&gt;CommonJS&lt;/a&gt;
&lt;/div&gt;
  &lt;div id=&quot;tab-id-2-jsesm&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-5&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-5&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; Fetch &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;@11ty/eleventy-fetch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token comment&quot;&gt;// https://developer.github.com/v3/repos/#get&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; json &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
			&lt;span class=&quot;token string&quot;&gt;&quot;https://api.github.com/repos/11ty/eleventy&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
				&lt;span class=&quot;token literal-property property&quot;&gt;duration&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1d&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// 1 day&lt;/span&gt;
				&lt;span class=&quot;token literal-property property&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;json&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// also supports &quot;text&quot; or &quot;buffer&quot;&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token literal-property property&quot;&gt;stargazers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; json&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;stargazers_count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;e&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Failed getting GitHub stargazers count, returning 0&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token literal-property property&quot;&gt;stargazers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;tab-id-2-jscjs&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-6&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-6&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; Fetch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;@11ty/eleventy-fetch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token comment&quot;&gt;// https://developer.github.com/v3/repos/#get&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; json &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
			&lt;span class=&quot;token string&quot;&gt;&quot;https://api.github.com/repos/11ty/eleventy&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
				&lt;span class=&quot;token literal-property property&quot;&gt;duration&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1d&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// 1 day&lt;/span&gt;
				&lt;span class=&quot;token literal-property property&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;json&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// also supports &quot;text&quot; or &quot;buffer&quot;&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token literal-property property&quot;&gt;stargazers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; json&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;stargazers_count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;e&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Failed getting GitHub stargazers count, returning 0&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token literal-property property&quot;&gt;stargazers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/seven-minute-tabs&gt;
&lt;/is-land&gt;
</content>
  </entry>
  <entry>
    <title>Quick Tip: Trigger a Netlify Build Every Day</title>
    <link href="https://www.11ty.dev/docs/quicktips/netlify-ifttt/" />
    <updated>2019-02-01T06:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/netlify-ifttt/</id>
    <content type="html">&lt;p&gt;In &lt;a href=&quot;https://www.11ty.dev/docs/quicktips/eliminate-js/&quot;&gt;Quick Tip #007&lt;/a&gt; we talked about migrating away from using a Client-side third-party JavaScript widget to display GitHub stargazer counts and towards a Data fetched at Build time approach.&lt;/p&gt;
&lt;p&gt;Updating this data at build time means that the data isn’t necessarily “live” (although the counts are likely cached at by at least one of the upstream dependencies of this widget, with a frequency that is out of your control).&lt;/p&gt;
&lt;p&gt;I’m comfortable with these numbers being a little delayed (more than the JS widget method was) and with this new approach I get more control over the frequency of updates BUT I do probably want to run the build at least once a day. To do this, I used an &lt;a href=&quot;https://ifttt.com/&quot;&gt;IFTTT&lt;/a&gt; applet to trigger my Netlify build to run every morning using &lt;a href=&quot;https://docs.netlify.com/configure-builds/build-hooks/&quot;&gt;Netlify’s Build Hooks&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Many other services also provide build hooks and/or scheduled builds!&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Heavily inspired by &lt;a href=&quot;https://www.hawksworx.com/note/tw/1038067638369443840&quot;&gt;Phil Hawksworth’s work on RSS Jamstack&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;step-1-create-a-build-hook&quot;&gt;&lt;span class=&quot;numberflag&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Step&lt;/span&gt; 1&lt;/span&gt; Create a Build Hook&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Go into your &lt;a href=&quot;https://app.netlify.com/&quot;&gt;Netlify&lt;/a&gt; site’s &lt;code&gt;Build &amp;amp; Deploy&lt;/code&gt; settings&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;Continuous Deployment&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add a &lt;code&gt;Build hook&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Name it &lt;code&gt;Deploy every day&lt;/code&gt; (or whatever you’d like)&lt;/li&gt;
&lt;li&gt;I selected the &lt;code&gt;main&lt;/code&gt; branch for my site.&lt;/li&gt;
&lt;li&gt;Save this and it will provide you with a long URL a la &lt;code&gt;https://api.netlify.com/build_hooks/SOME_ID_HERE&lt;/code&gt;. This is the URL you want.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;step-2-schedule-the-hook-trigger&quot;&gt;&lt;span class=&quot;numberflag&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Step&lt;/span&gt; 2&lt;/span&gt; Schedule the Hook Trigger&lt;/h2&gt;
&lt;p&gt;Here are a few options to trigger your build hook:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;a href=&quot;https://cron-job.org/&quot;&gt;cron-job.org&lt;/a&gt; to dynamically trigger your build hook.&lt;/li&gt;
&lt;li&gt;Use &lt;a href=&quot;https://ifttt.com/&quot;&gt;IFTTT&lt;/a&gt; (mini-tutorial below).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;mini-tutorials&quot;&gt;Mini-Tutorials&lt;/h2&gt;
&lt;h3 id=&quot;ifttt&quot;&gt;IFTTT&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Go to &lt;a href=&quot;https://ifttt.com/create&quot;&gt;&lt;code&gt;New Applet&lt;/code&gt; on ifttt.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;+this&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;Date &amp;amp; Time&lt;/code&gt; service&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;Every day at&lt;/code&gt; option (or whatever frequency you’d like)&lt;/li&gt;
&lt;li&gt;Select the time you’d like the build to run.&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;+that&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;Webhooks&lt;/code&gt; service&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;Make a web request&lt;/code&gt; option&lt;/li&gt;
&lt;li&gt;For the URL field, use the Build Hook URL you’ve already retrieved from Netlify.&lt;/li&gt;
&lt;li&gt;For the Method field, choose &lt;code&gt;POST&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For the Content Type field, choose &lt;code&gt;application/x-www-form-urlencoded&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For the Body field, type &lt;code&gt;{}&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Click the &lt;code&gt;Create action&lt;/code&gt; button.&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Finish&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  <entry>
    <title>Quick Tip: Fetch GitHub Stargazers Count (and More) at Build Time</title>
    <link href="https://www.11ty.dev/docs/quicktips/eliminate-js/" />
    <updated>2019-01-31T06:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/eliminate-js/</id>
    <content type="html">&lt;p&gt;Older iterations of this website used a third party JavaScript widget to show the number of GitHub Stars the project currently had. You can see it in action on the &lt;a href=&quot;https://v0-7-1.11ty.dev/docs/&quot;&gt;versioned docs for 0.7.1&lt;/a&gt; (scroll to the bottom).&lt;/p&gt;
&lt;p&gt;This was in fact the only &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag on the entire &lt;code&gt;11ty.dev&lt;/code&gt; web site and it was from a third party. Naturally, it needed to be annihilated.&lt;/p&gt;
&lt;p&gt;Let’s change up our architecture to ruthlessly eliminate this client-side JavaScript.&lt;/p&gt;
&lt;h2 id=&quot;get-the-stargazers-count-from-the-git-hub-api&quot;&gt;Get the Stargazers Count from the GitHub API&lt;/h2&gt;
&lt;p&gt;Read more at the &lt;a href=&quot;https://developer.github.com/v3/repos/#get&quot;&gt;GitHub API documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is a bit different from our client-side implementation because this data is only updated as often as your build runs. This is implemented using a global &lt;a href=&quot;https://www.11ty.dev/docs/data-js/&quot;&gt;JavaScript data file&lt;/a&gt; at &lt;code&gt;_data/github.js&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install new dependencies: &lt;code&gt;npm install node-fetch&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Read more about &lt;a href=&quot;https://www.npmjs.com/package/node-fetch&quot;&gt;&lt;code&gt;node-fetch&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;It’s better to use the &lt;a href=&quot;https://www.11ty.dev/docs/plugins/fetch/&quot;&gt;Eleventy Fetch utility&lt;/a&gt; instead, which will cache your fetch results to avoid hitting the GitHub API on every build.
&lt;ul&gt;
&lt;li&gt;Related &lt;a href=&quot;https://www.11ty.dev/docs/quicktips/cache-api-requests/&quot;&gt;Quick Tip: Cache Data Requests&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;codetitle codetitle-right-md&quot;&gt;_data/github.js&lt;/div&gt;
&lt;is-land on:visible import=&quot;/js/seven-minute-tabs.js&quot;&gt;
&lt;seven-minute-tabs class=&quot;tabs-flush&quot; persist sync autoheight&gt;
&lt;div role=&quot;tablist&quot; aria-label=&quot;Template Language Chooser&quot;&gt;
	&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/eliminate-js/#tab-id-4-jsesm&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jsesm&quot;&gt;ESM&lt;/a&gt;
&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/eliminate-js/#tab-id-4-jscjs&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jscjs&quot;&gt;CommonJS&lt;/a&gt;
&lt;/div&gt;
  &lt;div id=&quot;tab-id-4-jsesm&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-9&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-9&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; fetch &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;node-fetch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Fetching new github stargazers count…&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;token comment&quot;&gt;// GitHub API: https://developer.github.com/v3/repos/#get&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; res &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;https://api.github.com/repos/11ty/eleventy&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; json &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;token comment&quot;&gt;// prune the data to return only what we want&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token literal-property property&quot;&gt;stargazers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; json&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;stargazers_count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;tab-id-4-jscjs&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-10&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-10&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; fetch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;node-fetch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Fetching new github stargazers count…&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;token comment&quot;&gt;// GitHub API: https://developer.github.com/v3/repos/#get&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; res &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;https://api.github.com/repos/11ty/eleventy&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; json &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; res&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;token comment&quot;&gt;// prune the data to return only what we want&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token literal-property property&quot;&gt;stargazers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; json&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;stargazers_count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/seven-minute-tabs&gt;
&lt;/is-land&gt;
&lt;p&gt;Now in your templates you can output the stargazers count with:&lt;/p&gt;
&lt;div class=&quot;codetitle codetitle-left&quot;&gt;&lt;b&gt;Syntax &lt;/b&gt;Liquid, Nunjucks&lt;/div&gt;
&lt;pre class=&quot;language-html&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;{{ github.stargazers }} GitHub Stars&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which outputs&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;1515 GitHub Stars&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Bonus: I created a &lt;a href=&quot;https://github.com/11ty/11ty-website/blob/ac3579909078f860f4af1185c8f7353d56833c22/.eleventy.js#L82&quot;&gt;&lt;code&gt;humanReadableNum&lt;/code&gt; filter&lt;/a&gt;) using the &lt;a href=&quot;https://www.npmjs.com/package/human-readable-numbers&quot;&gt;&lt;code&gt;human-readable-numbers&lt;/code&gt;&lt;/a&gt; package to format the number.&lt;/p&gt;
&lt;h2 id=&quot;more-examples&quot;&gt;More Examples&lt;/h2&gt;
&lt;p&gt;You can look in the footer of this page to see examples of this in use on this very web site. I used it for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/11ty/11ty-website/blob/ac3579909078f860f4af1185c8f7353d56833c22/_data/npm.js&quot;&gt;NPM Download Count&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/11ty/11ty-website/blob/ac3579909078f860f4af1185c8f7353d56833c22/_data/github.js&quot;&gt;GitHub Stargazers Count&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/11ty/11ty-website/blob/ac3579909078f860f4af1185c8f7353d56833c22/_data/twitter.js&quot;&gt;Twitter Followers Count&lt;/a&gt; (careful here, this one is super brittle but Twitter’s API is historically anti-developer so 😇)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These all use the recommended caching mechanism described in the next section.&lt;/p&gt;
&lt;h2 id=&quot;recommended-cache-the-data-to-the-file-system&quot;&gt;Recommended: Cache the Data to the File System&lt;/h2&gt;
&lt;div class=&quot;elv-callout elv-callout-info&quot;&gt;&lt;div class=&quot;elv-callout-c&quot;&gt;It is highly &lt;strong&gt;recommended&lt;/strong&gt; to cache your API call data to the file system so that you aren’t making a ton of requests to an API with every build. Luckily, we have a &lt;a href=&quot;https://www.11ty.dev/docs/quicktips/cache-api-requests/&quot;&gt;Quick Tip on how to Cache your Data Requests&lt;/a&gt;!&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;update-counts-daily&quot;&gt;Update Counts Daily&lt;/h2&gt;
&lt;p&gt;If you want to update these counts automatically every day, read &lt;a href=&quot;https://www.11ty.dev/docs/quicktips/netlify-ifttt/&quot;&gt;Quick Tip #008—Trigger a Netlify Build Every Day with IFTTT&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Quick Tip: Adding a 404 Not Found Page to your Static Site</title>
    <link href="https://www.11ty.dev/docs/quicktips/not-found/" />
    <updated>2018-09-20T05:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/not-found/</id>
    <content type="html">&lt;p&gt;A &lt;code&gt;404: Not Found&lt;/code&gt; page is a pretty standard thing on the web. It’s particularly useful when someone shares a broken or mistyped link. You don’t need dynamic middleware to do this, it’s pretty easy to add to a statically generated site. There are a few options, depending on your web host:&lt;/p&gt;
&lt;p&gt;But first let’s make our &lt;code&gt;404.html&lt;/code&gt; template:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;---
title: Oops! Not Found
permalink: 404.html
---

&lt;span class=&quot;token doctype&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt; &lt;span class=&quot;token name&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;en&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;utf-8&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;viewport&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;width=device-width, initial-scale=1.0&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;{{ title }}&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;{{ title }}&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
			This is where you should tell the user how to find their content. Maybe on
			the &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;home page?&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Eleventy will output this template to &lt;code&gt;404.html&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;There is no step two if you’re using one of the following hosts (a &lt;code&gt;404.html&lt;/code&gt; file in your output directory is all you need):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://help.github.com/articles/creating-a-custom-404-page-for-your-github-pages-site/&quot;&gt;GitHub Pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.gitlab.com/ee/user/project/pages/introduction.html#custom-error-codes-pages&quot;&gt;GitLab Pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.netlify.com/docs/redirects/#custom-404&quot;&gt;Netlify&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developers.cloudflare.com/pages/platform/serving-pages/#not-found-behavior&quot;&gt;Cloudflare Pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://vercel.com/guides/custom-404-page#static-site-generator-ssg&quot;&gt;Vercel&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Netlify even has lovely &lt;a href=&quot;https://docs.netlify.com/routing/redirects/redirect-options/#custom-404-page-handling&quot;&gt;multi-language 404 page support too using &lt;code&gt;Redirects&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;htaccess&quot;&gt;.htaccess&lt;/h2&gt;
&lt;p&gt;For other hosts, if you use &lt;code&gt;.htaccess&lt;/code&gt; for configuration you can use &lt;code&gt;ErrorDocument&lt;/code&gt;. Make sure your root directory matches here!&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;ErrorDocument 404 /404.html&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;with-serve&quot;&gt;With &lt;code&gt;--serve&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;If you’re using the new &lt;a href=&quot;https://www.11ty.dev/docs/watch-serve/#eleventy-dev-server&quot;&gt;Eleventy Dev Server&lt;/a&gt; &lt;span data-pagefind-ignore eleventy:id-ignore class=&quot;minilink minilink-addedin&quot; data-uncoerced-version=&quot;2.0.0&quot;&gt;Added in v2.0.0&lt;/span&gt;, the &lt;code&gt;404.html&lt;/code&gt; convention is now provided to you for free!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Quick Tip: Super Simple CSS Concatenation</title>
    <link href="https://www.11ty.dev/docs/quicktips/concatenate/" />
    <updated>2018-06-27T05:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/concatenate/</id>
    <content type="html">&lt;p&gt;In some situations you may want to concatenate content files together into a single top level template. Maybe you want to create a single CSS file with all of your component CSS inside.&lt;/p&gt;
&lt;p&gt;Consider this sample &lt;code&gt;theme.njk&lt;/code&gt; file:&lt;/p&gt;
&lt;pre class=&quot;language-markdown&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-markdown&quot;&gt;&lt;span class=&quot;token front-matter-block&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;token front-matter yaml language-yaml&quot;&gt;permalink: theme.css&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;&lt;/span&gt;

{% include &quot;components/header.css&quot; %}
{% include &quot;components/footer.css&quot; %}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That’s an easy way to concatenate files and control the include order.&lt;/p&gt;
&lt;p&gt;You might imagine creating an &lt;code&gt;include-all&lt;/code&gt; &lt;a href=&quot;https://www.11ty.dev/docs/shortcodes/&quot;&gt;Shortcode&lt;/a&gt; that uses &lt;a href=&quot;https://www.npmjs.com/package/fast-glob&quot;&gt;&lt;code&gt;fast-glob&lt;/code&gt;&lt;/a&gt; to include a glob of files like &lt;code&gt;{% include-all &amp;quot;components/*.css&amp;quot; %}&lt;/code&gt;, but that’s an exercise left to the reader!&lt;/p&gt;
&lt;h2 id=&quot;capture-and-minify&quot;&gt;Capture and Minify&lt;/h2&gt;
&lt;p&gt;In our &lt;a href=&quot;https://www.11ty.dev/docs/quicktips/inline-css/&quot;&gt;Inline CSS Quick Tip&lt;/a&gt;, we discussed how to capture and minify a CSS file. This approach can be modified, of course, to capture multiple includes too!&lt;/p&gt;
&lt;pre class=&quot;language-html&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- capture the CSS content as a Nunjucks variable --&gt;&lt;/span&gt;
{% set css %}
{% include &quot;components/header.css&quot; %}
{% include &quot;components/footer.css&quot; %}
{% endset %}
&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- feed it through our cssmin filter to minify --&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token style&quot;&gt;&lt;span class=&quot;token language-css&quot;&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; css | cssmin | safe &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;warning-about-content-security-policy&quot;&gt;Warning about Content Security Policy&lt;/h2&gt;
&lt;div class=&quot;elv-callout elv-callout-warn&quot;&gt;&lt;div class=&quot;elv-callout-label&quot;&gt;WARNING&lt;/div&gt;&lt;div class=&quot;elv-callout-c&quot;&gt;
If you are using a Content Security Policy on your website, make sure the &lt;code&gt;style-src&lt;/code&gt; directive allows &lt;code&gt;&#39;unsafe-inline&#39;&lt;/code&gt;. Otherwise, your inline CSS will not load.
&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;work-with-what-you-have&quot;&gt;Work with what you have&lt;/h2&gt;
&lt;p&gt;Of course, Eleventy has no desire to replace your existing build pipeline. This is just a super simple example if you want something up and running quickly.&lt;/p&gt;
&lt;p&gt;That said, Eleventy wants to work with what you have. As an example, the &lt;a href=&quot;https://github.com/philhawksworth/eleventyone/&quot;&gt;&lt;code&gt;EleventyOne&lt;/code&gt; project scaffold&lt;/a&gt; is a fine example of using Eleventy with Gulp and Sass. At time of writing, the &lt;a href=&quot;https://github.com/zachleat/zachleat.com&quot;&gt;zachleat.com source code&lt;/a&gt; is an older example that works with Grunt and Sass (not anymore though).&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Quick Tip: Zero Maintenance Tag Pages for your Blog</title>
    <link href="https://www.11ty.dev/docs/quicktips/tag-pages/" />
    <updated>2018-06-08T05:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/tag-pages/</id>
    <content type="html">&lt;p&gt;This quick tip will show you how to automatically generate Tag Pages (lists of content tagged into a collection).&lt;/p&gt;
&lt;p&gt;We’ll use pagination to automatically generate a template for each tag we want to link to.&lt;/p&gt;
&lt;p&gt;Here’s a sample pagination template using Nunjucks:&lt;/p&gt;
&lt;pre class=&quot;language-markdown&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-markdown&quot;&gt;&lt;span class=&quot;token front-matter-block&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;token front-matter yaml language-yaml&quot;&gt;pagination:
  data: collections
  size: 1
  alias: tag
permalink: /tags/{{ tag }}/&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Tagged “{{ tag }}”&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ol&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
{% set taglist = collections[ tag ] %}
{% for post in taglist | reverse %}
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;{{ post.url }}&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;{{ post.data.title }}&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
{% endfor %}
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;ol&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First up notice how we’re pointing our &lt;code&gt;pagination&lt;/code&gt; to iterate over &lt;code&gt;collections&lt;/code&gt;, which is an object keyed with tag names pointing to the collection of content containing that tag.&lt;/p&gt;
&lt;p&gt;Consider these two sample markdown posts, one using a &lt;code&gt;tech&lt;/code&gt; tag and one using a &lt;code&gt;personal&lt;/code&gt; tag:&lt;/p&gt;
&lt;pre class=&quot;language-markdown&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-markdown&quot;&gt;&lt;span class=&quot;token front-matter-block&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;token front-matter yaml language-yaml&quot;&gt;title: My First Post
tags:
  - tech&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-markdown&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-markdown&quot;&gt;&lt;span class=&quot;token front-matter-block&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;token front-matter yaml language-yaml&quot;&gt;title: My Second Post
tags:
  - personal&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Our pagination template above will now generate two pages: &lt;code&gt;/tags/personal/index.html&lt;/code&gt; and &lt;code&gt;/tags/tech/index.html&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The great thing here is that we don’t have to manage our tag list in a central place. These tags can be littered throughout our content and individual tag pages will be created automatically.&lt;/p&gt;
&lt;h2 id=&quot;filtering-excluding&quot;&gt;Filtering / Excluding&lt;/h2&gt;
&lt;p&gt;Have a tag you’d like to exclude from this list? Use &lt;a href=&quot;https://www.11ty.dev/docs/pagination/#filtering-values&quot;&gt;pagination filtering&lt;/a&gt; like this:&lt;/p&gt;
&lt;pre class=&quot;language-markdown&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-markdown&quot;&gt;&lt;span class=&quot;token front-matter-block&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;token front-matter yaml language-yaml&quot;&gt;pagination:
  data: collections
  size: 1
  alias: tag
  filter:
    - tech
permalink: /tags/{{ tag }}/&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;---&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now Eleventy will only generate a &lt;code&gt;/tags/personal/&lt;/code&gt; template and &lt;code&gt;tech&lt;/code&gt; will be ignored.&lt;/p&gt;
&lt;h2 id=&quot;in-practice&quot;&gt;In Practice&lt;/h2&gt;
&lt;p&gt;This is currently in use on the &lt;a href=&quot;https://github.com/11ty/eleventy-base-blog&quot;&gt;&lt;code&gt;eleventy-base-blog&lt;/code&gt; sample project&lt;/a&gt;. Check out source code in the &lt;a href=&quot;https://github.com/11ty/eleventy-base-blog/blob/main/content/tags.njk&quot;&gt;&lt;code&gt;tags.njk&lt;/code&gt; template&lt;/a&gt; and &lt;a href=&quot;https://demo-base-blog.11ty.dev/tags/another-tag/&quot;&gt;see a live demo&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Quick Tip: Inline Minified JavaScript</title>
    <link href="https://www.11ty.dev/docs/quicktips/inline-js/" />
    <updated>2018-06-08T05:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/inline-js/</id>
    <content type="html">&lt;p&gt;&lt;em&gt;Originally posted on &lt;a href=&quot;https://www.zachleat.com/web/that-could-possibly-work/&quot;&gt;The Simplest Web Site That Could Possible Work Well on zachleat.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This tip works great if you have small JS utilities that you’d like to have in your &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;. For example, this works great with the Filament Group &lt;a href=&quot;https://github.com/filamentgroup/loadJS&quot;&gt;&lt;code&gt;loadJS&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;https://github.com/filamentgroup/loadCSS&quot;&gt;&lt;code&gt;loadCSS&lt;/code&gt;&lt;/a&gt; utilities.&lt;/p&gt;
&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;npm install terser&lt;/code&gt; to make the terser minifier available in your project.&lt;/p&gt;
&lt;h2 id=&quot;configuration&quot;&gt;Configuration&lt;/h2&gt;
&lt;p&gt;Add the following &lt;code&gt;jsmin&lt;/code&gt; filter to your Eleventy Config file:&lt;/p&gt;
&lt;div class=&quot;codetitle codetitle-right-md&quot;&gt;eleventy.config.js&lt;/div&gt;
&lt;is-land on:visible import=&quot;/js/seven-minute-tabs.js&quot;&gt;
&lt;seven-minute-tabs class=&quot;tabs-flush&quot; persist sync autoheight&gt;
&lt;div role=&quot;tablist&quot; aria-label=&quot;Template Language Chooser&quot;&gt;
	&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/inline-js/#tab-id-7-jsesm&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jsesm&quot;&gt;ESM&lt;/a&gt;
&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/inline-js/#tab-id-7-jscjs&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jscjs&quot;&gt;CommonJS&lt;/a&gt;
&lt;/div&gt;
  &lt;div id=&quot;tab-id-7-jsesm&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-15&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-15&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; minify &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;terser&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;eleventyConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addFilter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;jsmin&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; minified &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;minify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;code&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; minified&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;code&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Terser error: &quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token comment&quot;&gt;// Fail gracefully.&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; code&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;tab-id-7-jscjs&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-16&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-16&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; minify &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;terser&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;eleventyConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addFilter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;jsmin&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; minified &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;minify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;code&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; minified&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;code&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
			console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Terser error: &quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;token comment&quot;&gt;// Fail gracefully.&lt;/span&gt;
			&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; code&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/seven-minute-tabs&gt;
&lt;/is-land&gt;
&lt;h2 id=&quot;create-your-java-script-file&quot;&gt;Create your JavaScript File&lt;/h2&gt;
&lt;p&gt;Add a sample JavaScript file to your &lt;code&gt;_includes&lt;/code&gt; directory. Let’s call it &lt;code&gt;sample.js&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Hi&lt;/span&gt;
console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Hi&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;capture-and-minify&quot;&gt;Capture and Minify&lt;/h2&gt;
&lt;p&gt;Capture the JavaScript into a variable and run it through the filter (this sample is using Nunjucks syntax)&lt;/p&gt;
&lt;pre class=&quot;language-html&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- capture the JS content as a Nunjucks variable --&gt;&lt;/span&gt;
{% set js %} {% include &quot;sample.js&quot; %} {% endset %}
&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- feed it through our jsmin filter to minify --&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;span class=&quot;token language-javascript&quot;&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; js &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; jsmin &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; safe &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;warning-about-content-security-policy&quot;&gt;Warning about Content Security Policy&lt;/h3&gt;
&lt;div class=&quot;elv-callout elv-callout-warn&quot;&gt;&lt;div class=&quot;elv-callout-label&quot;&gt;WARNING&lt;/div&gt;&lt;div class=&quot;elv-callout-c&quot;&gt;
If you are using a Content Security Policy on your website, make sure the &lt;code&gt;script-src&lt;/code&gt; directive allows &lt;code&gt;&#39;unsafe-inline&#39;&lt;/code&gt;. Otherwise, your inline Javascript will not load.
&lt;/div&gt;&lt;/div&gt;
</content>
  </entry>
  <entry>
    <title>Quick Tip: Add Edit on GitHub Links to All Pages</title>
    <link href="https://www.11ty.dev/docs/quicktips/edit-on-github-links/" />
    <updated>2018-06-08T05:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/edit-on-github-links/</id>
    <content type="html">&lt;p&gt;It’s nice to be able to instantly edit your HTML on GitHub when you spot an error or an improvement you can make. Why not facilitate this by adding an &lt;em&gt;Edit this page on GitHub&lt;/em&gt; link to every page? You can see an example of this on our page footer.&lt;/p&gt;
&lt;h2 id=&quot;use-a-layout-file&quot;&gt;Use a Layout File&lt;/h2&gt;
&lt;p&gt;Make sure you’re using a Layout file so that you can add these to a single place and have the links applied to all of your pages.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.11ty.dev/docs/layouts/&quot;&gt;Read more about Layouts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here’s a sample:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;…
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;footer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      © 2019 Eleventy
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;footer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;add-your-link&quot;&gt;Add your link!&lt;/h2&gt;
&lt;p&gt;Edit your layout file to add the link. Provide the URL to the base of your repo and use the Eleventy provided &lt;code&gt;{{ page.inputPath }}&lt;/code&gt; variable to point to the correct input file. Yes, this will also work with paginated templates.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;…
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;footer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      © 2019 Eleventy
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;https://github.com/11ty/11ty-website/blob/main/{{ page.inputPath }}&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Edit this page on GitHub&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;footer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That’s it!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Quick Tip: Inline Minified CSS</title>
    <link href="https://www.11ty.dev/docs/quicktips/inline-css/" />
    <updated>2018-06-07T05:00:00Z</updated>
    <id>https://www.11ty.dev/docs/quicktips/inline-css/</id>
    <content type="html">&lt;p&gt;&lt;em&gt;Originally posted on &lt;a href=&quot;https://www.zachleat.com/web/that-could-possibly-work/&quot;&gt;The Simplest Web Site That Could Possibly Work Well on zachleat.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This tip works well on small sites that don’t have a lot of CSS. Inlining your CSS removes an external request from your critical path and speeds up page rendering times! If your CSS file is small enough, this is a simplification/end-around for &lt;a href=&quot;https://www.smashingmagazine.com/2015/08/understanding-critical-css/&quot;&gt;Critical CSS approaches&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;npm install clean-css&lt;/code&gt; to make the CSS minifier available in your project.&lt;/p&gt;
&lt;h2 id=&quot;configuration&quot;&gt;Configuration&lt;/h2&gt;
&lt;p&gt;Add the following &lt;code&gt;cssmin&lt;/code&gt; filter to your Eleventy Config file:&lt;/p&gt;
&lt;div class=&quot;codetitle codetitle-right-md&quot;&gt;eleventy.config.js&lt;/div&gt;
&lt;is-land on:visible import=&quot;/js/seven-minute-tabs.js&quot;&gt;
&lt;seven-minute-tabs class=&quot;tabs-flush&quot; persist sync autoheight&gt;
&lt;div role=&quot;tablist&quot; aria-label=&quot;Template Language Chooser&quot;&gt;
	&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/inline-css/#tab-id-5-jsesm&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jsesm&quot;&gt;ESM&lt;/a&gt;
&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/inline-css/#tab-id-5-jscjs&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jscjs&quot;&gt;CommonJS&lt;/a&gt;
&lt;/div&gt;
  &lt;div id=&quot;tab-id-5-jsesm&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-11&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-11&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; CleanCSS &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;clean-css&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;eleventyConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addFilter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;cssmin&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;CleanCSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;minify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;code&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;styles&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;tab-id-5-jscjs&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-12&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-12&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; CleanCSS &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;clean-css&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;eleventyConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addFilter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;cssmin&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;CleanCSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;minify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;code&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;styles&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/seven-minute-tabs&gt;
&lt;/is-land&gt;
&lt;h2 id=&quot;create-your-css-file&quot;&gt;Create your CSS File&lt;/h2&gt;
&lt;p&gt;Add a sample CSS file to your &lt;code&gt;_includes&lt;/code&gt; directory. Let’s call it &lt;code&gt;sample.css&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; fantasy&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;capture-and-minify&quot;&gt;Capture and Minify&lt;/h2&gt;
&lt;p&gt;Capture the CSS into a variable and run it through the filter (this sample is using Nunjucks syntax)&lt;/p&gt;
&lt;pre class=&quot;language-html&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- capture the CSS content as a Nunjucks variable --&gt;&lt;/span&gt;
{% set css %} {% include &quot;sample.css&quot; %} {% endset %}
&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- feed it through our cssmin filter to minify --&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token style&quot;&gt;&lt;span class=&quot;token language-css&quot;&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; css | cssmin | safe &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;warning-about-content-security-policy&quot;&gt;Warning about Content Security Policy&lt;/h2&gt;
&lt;div class=&quot;elv-callout elv-callout-warn&quot;&gt;&lt;div class=&quot;elv-callout-label&quot;&gt;WARNING&lt;/div&gt;&lt;div class=&quot;elv-callout-c&quot;&gt;
If you are using a Content Security Policy on your website, make sure the &lt;code&gt;style-src&lt;/code&gt; directive allows &lt;code&gt;&#39;unsafe-inline&#39;&lt;/code&gt;. Otherwise, your inline CSS will not load.
&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;or-use-an-11ty-js-template&quot;&gt;Or: use an &lt;code&gt;11ty.js&lt;/code&gt; Template&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Contributed by &lt;a href=&quot;https://github.com/zgreen&quot;&gt;Zach Green&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You can also inline minified CSS in a &lt;a href=&quot;https://www.11ty.dev/docs/languages/javascript/&quot;&gt;JavaScript template&lt;/a&gt;. This technique does not use filters, and instead uses &lt;code&gt;async&lt;/code&gt; functions:&lt;/p&gt;
&lt;div class=&quot;codetitle codetitle-right-md&quot;&gt;eleventy.config.js&lt;/div&gt;
&lt;is-land on:visible import=&quot;/js/seven-minute-tabs.js&quot;&gt;
&lt;seven-minute-tabs class=&quot;tabs-flush&quot; persist sync autoheight&gt;
&lt;div role=&quot;tablist&quot; aria-label=&quot;Template Language Chooser&quot;&gt;
	&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/inline-css/#tab-id-6-jsesm&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jsesm&quot;&gt;ESM&lt;/a&gt;
&lt;a href=&quot;https://www.11ty.dev/docs/quicktips/inline-css/#tab-id-6-jscjs&quot; role=&quot;tab&quot; data-tabs-persist=&quot;templatelang:jscjs&quot;&gt;CommonJS&lt;/a&gt;
&lt;/div&gt;
  &lt;div id=&quot;tab-id-6-jsesm&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-13&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-13&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; fs &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;node:fs/promises&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; path &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;node:path&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; CleanCSS &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;clean-css&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;lt;style&gt;
	  &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; fs
			&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;readFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;path&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;__dirname&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./sample.css&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;CleanCSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;minify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;styles&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;
	&amp;lt;/style&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;tab-id-6-jscjs&quot; role=&quot;tabpanel&quot;&gt;&lt;div class=&quot;syntax-highlight&quot;&gt;&lt;is-land on:visible data-wa-copy-button-target=&quot;highlighted-source-14&quot;&gt;
&lt;wa-copy-button from=&quot;highlighted-source-14&quot; tooltip-placement=&quot;left&quot;&gt;&lt;/wa-copy-button&gt;
&lt;/is-land&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; fs &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;node:fs/promises&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; path &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;node:path&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; CleanCSS &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;clean-css&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;lt;style&gt;
	  &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; fs
			&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;readFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;path&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;__dirname&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./sample.css&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
			&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;CleanCSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;minify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;styles&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;
	&amp;lt;/style&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/seven-minute-tabs&gt;
&lt;/is-land&gt;
</content>
  </entry>
</feed>