<?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: Lewis Sparlin</title>
    <description>The latest articles on DEV Community by Lewis Sparlin (@lsparlin).</description>
    <link>https://dev.to/lsparlin</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%2F388745%2F85e2fadb-9670-4d6a-9c37-75ead10dee1b.jpeg</url>
      <title>DEV Community: Lewis Sparlin</title>
      <link>https://dev.to/lsparlin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lsparlin"/>
    <language>en</language>
    <item>
      <title>Hotwire isn't only for Rails</title>
      <dc:creator>Lewis Sparlin</dc:creator>
      <pubDate>Wed, 15 Dec 2021 01:19:17 +0000</pubDate>
      <link>https://dev.to/lsparlin/hotwire-isnt-only-for-rails-5ekc</link>
      <guid>https://dev.to/lsparlin/hotwire-isnt-only-for-rails-5ekc</guid>
      <description>&lt;p&gt;At the end of 2020 the Basecamp team released a collection of Javascript libraries called &lt;a href="https://hotwired.dev" rel="noopener noreferrer"&gt;Hotwire&lt;/a&gt;. Modern web stacks have popularized javascript-rendered front ends and JSON transmissions. Hotwire's primary motivation is to reduce the Javascript footprint and allow application front ends to be created in primarily HTML. It pairs very nicely with the Ruby on Rails ideology and is often demonstrated in that context. I aim to write a series on how Hotwire can be used in any application to simplify development and reduce the need for heavy Javascript downloads. Hotwire currently consists of two javascript libraries: &lt;a href="https://turbo.hotwired.dev" rel="noopener noreferrer"&gt;Turbo&lt;/a&gt; and &lt;a href="https://stimulus.hotwired.dev" rel="noopener noreferrer"&gt;Stimulus&lt;/a&gt;. The first part of this series introduces Turbo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fya03bw9oho3tsl6of9af.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fya03bw9oho3tsl6of9af.png" alt="Hotwire splash page screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  HTML over the wire
&lt;/h2&gt;

&lt;p&gt;Hotwire prioritizes HTML over other means of data delivery. Pages can be written in HTML without the overhead of javascript-rendered templates. Pages can be updated by sending HTML from the server (or just plain HTML files) instead of JSON or XML - which involves interpreting data with Javascript. Everything on the web ultimately presents itself as HTML, so why not &lt;em&gt;start&lt;/em&gt; there? &lt;/p&gt;

&lt;h2&gt;
  
  
  What is Turbo?
&lt;/h2&gt;

&lt;p&gt;According to their splash page Turbo is a javascript library that offers developers "The speed of a single-page web applications without having to write any JavaScript". This is pretty cool and the complete opposite of most popular Javascript libraries. Turbo doesn't render HTML from a template, it simply interprets an HTML page and adds common functionality. There is no Javascript interface; any desired functionality is added using plain HTML. &lt;code&gt;data-turbo-*&lt;/code&gt; attributes are sometimes used to declare non-default behavior.&lt;/p&gt;

&lt;p&gt;The turbo library has three main concepts it calls Drive, Frames and Streams. &lt;/p&gt;

&lt;h3&gt;
  
  
  Turbo Drive
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://turbo.hotwired.dev/handbook/drive" rel="noopener noreferrer"&gt;Turbo Drive&lt;/a&gt; is nearly invisible. A developer doesn't directly interact with it in most cases. Adding the Turbo library on any HTML page automatically translates all &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; (link) and &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; tags to Javascript interactions. Visiting a page in the application will quickly replace the page &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; without the browser actually loading a new page. Submitting a form will have the same effect. This gives plain HTML applications a more interactive feel, similar to single-page applications, but without the heavier javascript frameworks. I'd love to give some code examples demonstrating Turbo Drive, but it really is that easy: import it, it works.&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="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Turbo&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@hotwired/turbo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're not bundling javascript, Turbo can be included from a CDN like &lt;a href="https://skypack.dev" rel="noopener noreferrer"&gt;Skypack&lt;/a&gt; or &lt;a href="https://unpkg.com" rel="noopener noreferrer"&gt;Unpkg&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- from a CDN --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt; &lt;span class="na"&gt;defer&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Turbo&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://cdn.skypack.dev/@hotwired/turbo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Turbo Frames
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://turbo.hotwired.dev/handbook/frames" rel="noopener noreferrer"&gt;Turbo Frames&lt;/a&gt; (and Streams) is the exciting part of the Turbo library. So much behavior can be added to an app with Frames - still just by writing HTML! I believe there is too much to cover in this Hotwire overview, the next part in this series will be dedicated to Frames. Here is a quick preview of what Turbo Frames can do.&lt;/p&gt;




&lt;h4&gt;
  
  
  Coffee Boutique
&lt;/h4&gt;

&lt;p&gt;In an alternate reality I run a small coffee stand for people willing to wait for slow, manual coffee brewing methods. I offer pour-over, French press, and Aeropress coffees. The HTML for the self-serve brew method selection looks like this (simplified):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu6khcpigwgr2qmh3ckl0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu6khcpigwgr2qmh3ckl0.png" alt="Coffee selection screenshot"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;How shall I brew your ☕️&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;turbo-frame&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"coffee_selection"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Pour-over&lt;span class="nt"&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;... describes pour-over ...&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"choose_pour_over.html"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      Pour my coffee
    &lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;French press&lt;span class="nt"&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;... describes french press ...&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"choose_french_press.html"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      (French) Press my coffee
    &lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Aeropress&lt;span class="nt"&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;... describes aeropress ...&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"choose_aeropress.html"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      (Aero)Press my coffee
    &lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/turbo-frame&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wrapping the selection components in a &lt;code&gt;&amp;lt;turbo-frame&amp;gt;&lt;/code&gt; causes links inside the tag to only effect the context of that frame. Clicking links or submitting forms will not update the entire page, instead they expect HTML from the response to contain directions on how to update the frame. When the response has a matching &lt;code&gt;turbo-frame&lt;/code&gt; ID, the contents in the frame are replaced with the contents from the respective tag in the response. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnd0u8w7yq59e015cqdba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnd0u8w7yq59e015cqdba.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- choose_pour_over.html --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;turbo-frame&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"coffee_selection"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;          
  &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Pour-over&lt;span class="nt"&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Great choice!&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Wait time 5 minutes&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/turbo-frame&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No Javascript was written to cause the component on the page to be replaced with user feedback. The &lt;code&gt;&amp;lt;turbo-frame&amp;gt;&lt;/code&gt; tag did all the work. Clicking the &lt;strong&gt;"Pour my Coffee"&lt;/strong&gt; link causes the contents of the file &lt;code&gt;choose_pour_over.html&lt;/code&gt; to be fetched and Turbo replaces the frame. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;a href="https://replit.com/@lsparlin/hotwired-frames-coffee" rel="noopener noreferrer"&gt;My working code example is on Replit&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Turbo Streams
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://turbo.hotwired.dev/handbook/streams" rel="noopener noreferrer"&gt;Turbo Streams&lt;/a&gt; adds HTML tags that can give more granular page update directions. The &lt;code&gt;&amp;lt;turbo-stream&amp;gt;&lt;/code&gt; tag supports HTML attributes that give instructions to replace certain parts of a page or to append or prepend HTML from inside the tag. It's a super powerful part of the Turbo library and deserves its own coverage. I plan on including a Turbo Stream article later in this series to demonstrate the huge potential of communicating front-end update instructions using plain HTML.&lt;/p&gt;

&lt;p&gt;A similar replacement like the example above would be more explicit with Turbo Stream markup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;turbo-stream&lt;/span&gt; &lt;span class="na"&gt;action=&lt;/span&gt;&lt;span class="s"&gt;"replace"&lt;/span&gt; &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"coffee_selection"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;template&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;          
      &lt;span class="nt"&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Pour-over&lt;span class="nt"&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Great choice!&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Wait time 5 minutes&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/turbo-stream&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Hotwire and specifically Turbo include a lot of useful tools  for developing applications without a heavy Javascript framework. Turbo enhances page links and forms for free just by including the library. Frames and Streams are extremely powerful for building front end interactions. And all of it can be done in HTML. Hotwire seems most popular in the Rails community, but it has lots of potential on its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://hotwired.dev" rel="noopener noreferrer"&gt;hotwired.dev homepage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://turbo.hotwired.dev/handbook/introduction" rel="noopener noreferrer"&gt;Turbo handbook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://skypack.dev" rel="noopener noreferrer"&gt;Skypack&lt;/a&gt; CDN for node packages&lt;/li&gt;
&lt;li&gt;My Turbo Frames code example at Replit &lt;a href="https://replit.com/@lsparlin/hotwired-frames-coffee" rel="noopener noreferrer"&gt;lsparlin/hotwired-frames-coffee&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>html</category>
      <category>javascript</category>
      <category>hotwire</category>
      <category>turbo</category>
    </item>
    <item>
      <title>Customize Stimulus Attributes, Avoid Conflicts</title>
      <dc:creator>Lewis Sparlin</dc:creator>
      <pubDate>Wed, 10 Nov 2021 21:33:19 +0000</pubDate>
      <link>https://dev.to/knowndecimal/customize-stimulus-attributes-avoid-conflicts-ce7</link>
      <guid>https://dev.to/knowndecimal/customize-stimulus-attributes-avoid-conflicts-ce7</guid>
      <description>&lt;p&gt;&lt;a href="https://stimulus.hotwired.dev/"&gt;Stimulus&lt;/a&gt; is all about giving you front-end functionality with minimal JavaScript fuss and weight, but in certain cases, its data attributes can run into conflict with other libraries. I've recently made a pull request to add this to their docs, but for anyone else who's encountered this conflict, a little reconfiguration of the library's schema can keep your Stimulus implementation conflict-free.&lt;/p&gt;

&lt;p&gt;Outside of a build system, Stimulus is initialized as documented in their &lt;a href="https://stimulus.hotwired.dev/handbook/installing#using-without-a-build-system"&gt;handbook&lt;/a&gt;:&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Application&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://unpkg.com/@hotwired/stimulus/dist/stimulus.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Stimulus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stimulus uses HTML data attributes to target and add listeners to elements on the page. In Stimulus if you wanted a button to show a modal, you might write something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;data-action=&lt;/span&gt;&lt;span class="s"&gt;"modal#show"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
 Set up your profile
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you were to include Stimulus in a project that already had several JavaScript libraries, you may encounter what I encountered. The HTML attribute &lt;code&gt;data-action&lt;/code&gt; was already being monitored by another library. Fortunately, after reading through their code I discovered there are parameters that can be passed to &lt;code&gt;Application&lt;/code&gt;. The data attributes Stimulus looks for can be customized by passing a different "schema".&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Application&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;defaultSchema&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://unpkg.com/@hotwired/stimulus/dist/stimulus.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;customSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;defaultSchema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;actionAttribute&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-stimulus-action&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Stimulus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;documentElement&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;customSchema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would allow you to create Stimulus event listeners using your custom attribute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;data-stimulus-action=&lt;/span&gt;&lt;span class="s"&gt;"modal#show"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
 Setup your profile
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stimulus is a great tool that gives you a lot of power on the front end for very little overhead— if you'd like to see a blog series from me to get a thorough introduction to the library, let us know!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>hotwire</category>
      <category>stimulus</category>
    </item>
    <item>
      <title>Hacktoberfest and Hello</title>
      <dc:creator>Lewis Sparlin</dc:creator>
      <pubDate>Wed, 03 Nov 2021 20:45:16 +0000</pubDate>
      <link>https://dev.to/lsparlin/hacktoberfest-and-hello-3igf</link>
      <guid>https://dev.to/lsparlin/hacktoberfest-and-hello-3igf</guid>
      <description>&lt;p&gt;Hi 👋, I'm Lewis! In addition to being a Hacktoberfest retro, this is also my DEV introduction. This being my first DEV post I'm tempted to ramble on a bit, but you can learn more about me in my bio if you're interested. This month I'll be doing my best to write more and share my experiences and what I'm learning. Although I have been working in tech for a long time, Hacktoberfest 2021 was my first earnest effort contributing to Open Source.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hacktoberfest 2021
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F790q6dn38588tivpcw4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F790q6dn38588tivpcw4t.png" alt="Hacktoberfest 2021 header from DigitalOcean"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hacktoberfest.digitalocean.com" rel="noopener noreferrer"&gt;Hacktoberfest&lt;/a&gt; is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;a month-long celebration of open source software run by &lt;a href="https://www.digitalocean.com" rel="noopener noreferrer"&gt;DigitalOcean&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In a nutshell, developers were able to authenticate with Github and after 4 confirmed pull requests merged for open source projects, get free swag. Of course for many people, a free tee shirt isn't a huge motivator. Personally I felt it was a great learning experience and it was satisfying to give back to Open Source projects. The personal growth and community involvement were the greatest rewards.&lt;/p&gt;
&lt;h3&gt;
  
  
  Community 💙
&lt;/h3&gt;

&lt;p&gt;I was introduced to Hacktoberfest by a wonderful online community I joined this year, &lt;a href="https://virtualcoffee.io" rel="noopener noreferrer"&gt;Virtual Coffee&lt;/a&gt;. Aside: you should join Virtual Coffee, they're the most authentic group I've ever met online!! As a community, they challenged members to be involved. They facilitated mentorship and had weekly check-ins to give everyone opportunity to talk about where they were contributing.&lt;/p&gt;

&lt;p&gt;I had the privilege of mentoring &lt;a class="mentioned-user" href="https://dev.to/adiatiayu"&gt;@adiatiayu&lt;/a&gt;, who is well known here and on CodeNewbies for her excellent writing. I really enjoyed getting to know her and the maintainers I interacted with over the past month. As an introvert, doing Hacktoberfest with a community was the motivation I needed to really get involved.&lt;/p&gt;
&lt;h3&gt;
  
  
  Things I didn't know about Github
&lt;/h3&gt;

&lt;p&gt;I've used Github for work for years, but there were several cool new things I learned thanks to getting into Hacktoberfest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting a repository contributor-friendly&lt;/strong&gt;&lt;br&gt;
Thanks to &lt;a class="mentioned-user" href="https://dev.to/kirkcodes"&gt;@kirkcodes&lt;/a&gt; for this great &lt;a href="https://youtu.be/dH1NwpOtppE" rel="noopener noreferrer"&gt;presentation&lt;/a&gt; on VirtualCoffee's YouTube channel. I haven't had a chance to open source a project myself, so I'll be glad I wrote this down someday. Under the Github Insights tab, the community section has an interactive list of recommended as the ideal setup to start an open source project that is contributor-friendly. I knew about &lt;code&gt;README&lt;/code&gt; of course, but there are so many other great ways for maintainers to guide their contributors.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv0r0cilqmvzll88w7t4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv0r0cilqmvzll88w7t4z.png" alt="Githubs community insight checklist"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pull Request Templates!&lt;/strong&gt;&lt;br&gt;
Having interacted now with several OSS projects that utilize this, it's now hard to imagine contributing without them. If you're not familiar, you can add the file &lt;code&gt;.github/PULL_REQUEST_TEMPLATE.md&lt;/code&gt; to a repository and contributors will have a starting point when opening up a pull request! A pull request template can communicate to contributors what you expect them to describe in their pull request description. This is extremely helpful and allows contributors (like me) be familiar with expectations. Something simple like this would suffice in most cases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## What Changed&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- describe what you changed --&amp;gt;&lt;/span&gt;

&lt;span class="gu"&gt;## Issues&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- mention the issue this addresses --&amp;gt;&lt;/span&gt;

&lt;span class="gu"&gt;## Screenshots&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- Add some screenshots --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Templates can also be created for the various types of issues as described by &lt;a href="https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/about-issue-and-pull-request-templates" rel="noopener noreferrer"&gt;Github's documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Building Confidence
&lt;/h3&gt;

&lt;p&gt;Imposter syndrome is a regular topic in developer communities and it effects me too. Wavering confidence and the tendency to doubt my own abilities has been a consistent struggle throughout my journey as a developer. This last month I found that contributing to open source can be a great confidence boost. It feels good to get involved in projects I care about. There is affirmation in knowing that people I don't know appreciate code I send to them over the internet. I also learned new patterns and ways of approaching things by getting into other people's code. I highly recommend contributing to open source earlier than I did for those who have the ability. It's great for everybody involved.&lt;/p&gt;
&lt;h2&gt;
  
  
  Contributions
&lt;/h2&gt;

&lt;p&gt;The following projects all have excellent maintainers and core teams that were a joy to work with. I am especially fond of Forem (the DEV platform). Shoutout to &lt;a class="mentioned-user" href="https://dev.to/nickytonline"&gt;@nickytonline&lt;/a&gt; and &lt;a class="mentioned-user" href="https://dev.to/coffeecraftcode"&gt;@coffeecraftcode&lt;/a&gt; for being extremely welcoming members of Forem. I plan to continue being a regular contributor thanks to the great experience I had during Hacktoberfest. &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/forem" rel="noopener noreferrer"&gt;
        forem
      &lt;/a&gt; / &lt;a href="https://github.com/forem/forem" rel="noopener noreferrer"&gt;
        forem
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      For empowering community 🌱
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/codethesaurus" rel="noopener noreferrer"&gt;
        codethesaurus
      &lt;/a&gt; / &lt;a href="https://github.com/codethesaurus/codethesaur.us" rel="noopener noreferrer"&gt;
        codethesaur.us
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A polyglot developer reference tool to compare programming language concepts side-by-side! Great for learning new languages or using for reference.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Virtual-Coffee" rel="noopener noreferrer"&gt;
        Virtual-Coffee
      &lt;/a&gt; / &lt;a href="https://github.com/Virtual-Coffee/virtualcoffee.io" rel="noopener noreferrer"&gt;
        virtualcoffee.io
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Public site for Virtual Coffee
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;






&lt;p&gt;Thank you to DigitalOcean and Virtual Coffee for the opportunity and encouragement to get involved in open source!&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>opensource</category>
      <category>devjournal</category>
      <category>github</category>
    </item>
  </channel>
</rss>
