<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael Scharnagl</title>
    <description>The latest articles on DEV Community by Michael Scharnagl (@justmarkup).</description>
    <link>https://dev.to/justmarkup</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F14151%2Fe424bf93-3c17-46c6-bfb9-7cdf18d87b11.jpeg</url>
      <title>DEV Community: Michael Scharnagl</title>
      <link>https://dev.to/justmarkup</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/justmarkup"/>
    <language>en</language>
    <item>
      <title>Boring by default</title>
      <dc:creator>Michael Scharnagl</dc:creator>
      <pubDate>Fri, 22 Jan 2021 19:42:10 +0000</pubDate>
      <link>https://dev.to/justmarkup/boring-by-default-1km</link>
      <guid>https://dev.to/justmarkup/boring-by-default-1km</guid>
      <description>&lt;p&gt;When starting a new web project one often reaches for new cutting-edge technologies to be up-to-date. However, why not start with the basics first and add stuff on top if you really need it. Boring by default.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I really like new and cutting-edge technology, but lately, I feel more and more that we're just over-engineering everything... 😢&lt;/p&gt;

&lt;p&gt;I spent the last hour solving problems that I wouldn't have had with a "traditional stack", static HTML and some hand-written JavaScript.&lt;/p&gt;

&lt;p&gt;— Stefan Judis (&lt;a class="comment-mentioned-user" href="https://dev.to/stefanjudis"&gt;@stefanjudis&lt;/a&gt;
) &lt;a href="https://twitter.com/stefanjudis/status/1213906461543321602?ref_src=twsrc%5Etfw"&gt;January 5, 2020&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As Stefan and many others, I also often see and experience over-engineered sites regularly. Let's see why starting with a traditional, or boring stack may not be the worst idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the basics #
&lt;/h2&gt;

&lt;p&gt;When starting a new website all you need to build it is a computer, an editor and a browser to view it. Yes, that's all – no need for a build script or task runners or for installing something via npm. Yet, nowadays we tend to over-complicate all of this. The arguments for this are that it makes it so much easier to build a site using all this tools, another is that you will clearly need all of this once several people work on the project and/or the project is getting large.&lt;/p&gt;

&lt;p&gt;These are all valid points, but to you really need this all from the beginning? What if you abandon the project (like the millions of half-finished side-projects out there), or find that a static HTML page is all you need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Maintenance #
&lt;/h2&gt;

&lt;p&gt;Ever needed to change "just a small thing" on an old page you build years ago? I recently had the pleasure and the simple task of changing some colors in CSS lead to a whole day of me wrangling with old deprecated Grunt tasks and trying to get the build task running.&lt;/p&gt;

&lt;p&gt;The same will happen to you as well some day, everybody used Grunt back then and almost nobody does today, the same will probably also happen to Babel or other tools – at least you would have to get an old version running which isn't supported anymore at the time you want to change some CSS in 2025.&lt;/p&gt;

&lt;p&gt;That's why starting with HTML, CSS and JavaScript without the need to ever compile anything on your local machine is a good idea. Changing some colors on such a page would indeed only take minutes and not a whole day.&lt;/p&gt;

&lt;h2&gt;
  
  
  It depends #
&lt;/h2&gt;

&lt;p&gt;That said, if your whole team is really into React or Vue or AnotherFrameworkDevelopedRightNow and you know for sure that using these tools is the perfect choice for you. Use that. But, don't tell others they also have to and that this is the only way to build things – it all depends.&lt;/p&gt;

&lt;p&gt;Your job as an developer is to decide, to decide what tools to use, to decide what frameworks to use, to decide what to prioritize, to decide what is the best way to maintain a project – a lot of questions only your team is able to answer.&lt;/p&gt;

&lt;p&gt;Again, it all depends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion #
&lt;/h2&gt;

&lt;p&gt;Never feel ashamed to start with a traditional (boring) stack – you may be the one launching a great project, while others still set up there build scripts.&lt;/p&gt;

&lt;p&gt;Be boring by default and enhance on the way.&lt;/p&gt;

</description>
      <category>html</category>
    </item>
    <item>
      <title>Integrate Pocket in Eleventy</title>
      <dc:creator>Michael Scharnagl</dc:creator>
      <pubDate>Tue, 19 Jan 2021 12:04:10 +0000</pubDate>
      <link>https://dev.to/justmarkup/integrate-pocket-in-eleventy-17p7</link>
      <guid>https://dev.to/justmarkup/integrate-pocket-in-eleventy-17p7</guid>
      <description>&lt;p&gt;I have been using &lt;a href="https://app.getpocket.com/"&gt;Pocket&lt;/a&gt; since many years to organize my bookmarks and reading list and thought it would be great to show them on my blog where I use &lt;a href="https://www.11ty.dev/"&gt;Eleventy&lt;/a&gt;. In this article you will learn how to get your data from Pocket and show them on your Eleventy site.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get a consumer key from Pocket #
&lt;/h2&gt;

&lt;p&gt;We assume that you already have a Pocket account, if not you should register an account &lt;a href="https://getpocket.com/"&gt;there&lt;/a&gt; first.&lt;/p&gt;

&lt;p&gt;First, we need a consumer key, which we get on their &lt;a href="https://getpocket.com/developer/apps/"&gt;Developer site&lt;/a&gt; - use "Create an Application" there. Give it a name and description of your choice, set permissions to Retrieve, and Platforms to Web. After the application got created you will be directed to a site where you can see your consumer key which you should save somewhere now as we need it later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Obtain the access token #
&lt;/h2&gt;

&lt;p&gt;To be able to use the Pocket API, we also need the access token of our account. To get this you can use &lt;a href="https://github.com/mheap/pocket-auth-cli"&gt;pocket-auth-cli&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open your terminal and install the package globally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; pocket-auth-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the installation is finished run the following command (replace  with the key you saved above):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pocket-auth &amp;lt;consumer_key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything worked, you will see your access_token in your terminal. Copy and save that as we also need this one later as well.&lt;/p&gt;

&lt;p&gt;You can test if all worked by opening the URL &lt;a href="https://getpocket.com/v3/get?consumerkey=%3Cconsumer_key%3E&amp;amp;access_token=%3Caccess_token%3E"&gt;https://getpocket.com/v3/get?consumerkey=&amp;amp;access_token=&lt;/a&gt; in your browser (replace &lt;code&gt;&amp;lt;consumer_key&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;access_token&amp;gt;&lt;/code&gt; with your data)&lt;/p&gt;

&lt;h2&gt;
  
  
  Fetch data from Pocket #
&lt;/h2&gt;

&lt;p&gt;Now, let's switch to your Eleventy project.&lt;/p&gt;

&lt;p&gt;To start, create a file called pocket.js and save it in the &lt;code&gt;_data&lt;/code&gt; folder (if you don't have the &lt;code&gt;_data&lt;/code&gt; folder already create it now)&lt;/p&gt;

&lt;p&gt;Now, switch back to the terminal and navigate to the root of your Eleventy project. To be able to fetch data, we need to install node-fetch and to be able to read our environment variables (more on this later) we need the dotenv package&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;node-fetch dotenv &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this has been installed, we need to define the environment variables. To do this in your local project, create a file called .env (if there is none) and safe it in the root of the project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; : Never add your environment variables and files (in our case &lt;code&gt;.env&lt;/code&gt;) to your Git repository. To avoid ever having them there you can use a &lt;code&gt;.gitignore&lt;/code&gt; file in the root of your project and add &lt;code&gt;.env&lt;/code&gt; there.&lt;/p&gt;

&lt;p&gt;Next, we define our variables there:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;POCKET_CONSUMER_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;CONSUMER_KEY
&lt;span class="nv"&gt;POCKET_ACCESS_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ACCESS_TOKEN
&lt;span class="nv"&gt;POCKET_TAG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;TAG
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace CONSUMERKEY and ACCESSTOKEN with your values you saved above. For TAG, you can either use the value &lt;em&gt;all&lt;/em&gt; to get all, or use one of your tags to be able to define what you want to show in public. I use a tag called public for example.&lt;/p&gt;

&lt;p&gt;Now, let's move back to our code editor and open the &lt;code&gt;pocket.js&lt;/code&gt; file we created before and insert the following code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;node-fetch&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dotenv&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CONSUMER_KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;POCKET_CONSUMER_KEY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ACCESS_TOKEN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;POCKET_ACCESS_TOKEN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;TAG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;POCKET_TAG&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;POCKET_URI&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`https://getpocket.com/v3/get?consumer_key=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;CONSUMER_KEY&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;amp;access_token=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;ACCESS_TOKEN&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;amp;tag=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;TAG&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;POCKET_URI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; 
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's go through this. In the first two lines we import the packages we installed before. Next we define some variables we extract from the &lt;code&gt;.env&lt;/code&gt; file. The interesting part happens in &lt;code&gt;module.exports&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There we have a function, which uses fetch to, well fetch the data from the pocket API, transform this to json and return an Object with our list of items we saved in Pocket.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrate in your template #
&lt;/h2&gt;

&lt;p&gt;Now, that we have the data fetch in place, let's integrate the data in our template. We are using &lt;a href="https://mozilla.github.io/nunjucks/"&gt;Nunjucks&lt;/a&gt; as our template engine as the example here, but you can also use any other template language supported by Eleventy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;{% if pocket.length %} 
  &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt; 
  {%- for entry in pocket | reverse %} 
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; 
      &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ entry.given_url }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{{ entry.resolved_title }}&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&lt;/span&gt; 
      &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;{{ entry.excerpt }}&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt; 
    &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt; 
  {%- endfor %} 
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
{%- endif %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's have a look there. First we check if there are any items available at all, and if yes, output an &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now we use a for loop to go through every item and output some of the values we got from Pocket. On the &lt;a href="https://getpocket.com/developer/docs/v3/retrieve"&gt;Pocket Developer site&lt;/a&gt; you find a list of all values available.&lt;/p&gt;

&lt;p&gt;With this in place, we can go back to the terminal and run the Eleventy serve command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx eleventy &lt;span class="nt"&gt;--serve&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you now open the template where you integrated Pocket you should see a list of all your items (or if you used a specific tag, all your items tagged with the specific tag).&lt;/p&gt;

&lt;p&gt;You can now deploy your site and show your Pocket list on your site.&lt;/p&gt;

&lt;h2&gt;
  
  
  Extra (automatic deploys, caching) #
&lt;/h2&gt;

&lt;p&gt;You most probably want to have the data up-to-date and have automatic deploys. Here is a tutorial how you can do that on &lt;a href="https://www.11ty.dev/docs/quicktips/netlify-ifttt/"&gt;Netlify&lt;/a&gt;, but this is also possible with many other hosts. In my case it is a bit more complicated, so will share my setup to do automatic deploys on a traditional hoster in a future article.&lt;/p&gt;

&lt;p&gt;Be aware that there is a rate limit, but it is very generous with &lt;a href="https://getpocket.com/developer/docs/rate-limits"&gt;320 calls per hour&lt;/a&gt;. You probably will never reach that, but you may still want to cache data requests. I won't cover this here as well, if you want to integrate caching I can recommend this &lt;a href="https://www.11ty.dev/docs/quicktips/cache-api-requests/"&gt;tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Bookmarks #
&lt;/h2&gt;

&lt;p&gt;If you are curious what I have saved at Pocket have a look at my &lt;a href="https://justmarkup.com/bookmarks/"&gt;bookmark section&lt;/a&gt;&lt;/p&gt;

</description>
      <category>jamstack</category>
      <category>eleventy</category>
      <category>node</category>
      <category>pocket</category>
    </item>
  </channel>
</rss>
