<?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>Forem: vinney cavallo</title>
    <description>The latest articles on Forem by vinney cavallo (@vinneycavallo).</description>
    <link>https://forem.com/vinneycavallo</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%2F11223%2Fd02c4e26-9998-483b-b69f-9a44521f4665.JPG</url>
      <title>Forem: vinney cavallo</title>
      <link>https://forem.com/vinneycavallo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/vinneycavallo"/>
    <language>en</language>
    <item>
      <title>Using webpack-dev-server and HMR on a Remote Machine/VPS</title>
      <dc:creator>vinney cavallo</dc:creator>
      <pubDate>Wed, 27 Jun 2018 04:00:00 +0000</pubDate>
      <link>https://forem.com/vinneycavallo/using-webpack-dev-server-and-hmr-on-a-remote-machinevps-303c</link>
      <guid>https://forem.com/vinneycavallo/using-webpack-dev-server-and-hmr-on-a-remote-machinevps-303c</guid>
      <description>&lt;p&gt;&lt;em&gt;Setting up&lt;/em&gt; webpack-dev-server HMR on a remote machine to work over nginx isn’t fun - but &lt;strong&gt;USING IT IS!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem:&lt;/strong&gt; Using &lt;code&gt;webpack-dev-server&lt;/code&gt;’s livereloading and HMR features on a remote machine (probably over nginx)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution&lt;/strong&gt; is further down on this page for the impatient &lt;em&gt;(or those who very reasonably don’t care to read about how I got into this situation and how long it took me to solve it!)&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fluffy Backstory
&lt;/h2&gt;

&lt;p&gt;The joys of livereloading, hot module replacement, instant style updates and their related, rapid relatives have only recently come into focus for me. Now that I’ve seen this dazzling light the idea of toiling away in a dark alley of constantly &lt;code&gt;Ctrl-R&lt;/code&gt;ing a browser window makes me &lt;a href="https://dev.tojavascript:void(0)"&gt;very miserable&lt;/a&gt;. I’ve recently adopted a workflow that involves working on a remote, hosted VPS over &lt;code&gt;SSH&lt;/code&gt; in the terminal. I love almost all the &lt;a href="https://dev.tojavascript:void(0)"&gt;things about it&lt;/a&gt;, but it briefly pushed me down the dark &lt;code&gt;Ctrl-R&lt;/code&gt; alley. The main reason is simple: You’re no longer hitting a &lt;code&gt;localhost:NNNN&lt;/code&gt; page anymore - instead you’re going out over the internet.&lt;/p&gt;

&lt;p&gt;There are a few issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On-Disk vs In-Memory builds of the site&lt;/li&gt;
&lt;li&gt;Hosts and DNS&lt;/li&gt;
&lt;li&gt;Ports (who uses which ports, who knows this, how to tell the various parties what’s where)&lt;/li&gt;
&lt;li&gt;Firewalls&lt;/li&gt;
&lt;li&gt;Things about HTML headers&lt;/li&gt;
&lt;li&gt;Things about websockets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I spent hours and hours and purpled all google searches I could think of. sometimes after spiraling around I’d come back around to older google search results but this time I’d have a different set of configuration combinations as a result of walking through &lt;em&gt;previous&lt;/em&gt; google search results so I’d try some of these things mixed in with weird combinations of other stuff I’d already tried.&lt;br&gt;&lt;br&gt;
It was one big shitty salad of port, host, webserver combinations.&lt;/p&gt;

&lt;p&gt;By the end, the viable solution is, in summary, this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A publicly-accessible URL (let’s call it &lt;code&gt;http://devenv.com&lt;/code&gt;. and I already checked, it’s taken) with DNS records pointing this domain to the IP of the VPS we’re working off of.&lt;/li&gt;
&lt;li&gt;A static-built version of the files at &lt;code&gt;/dist&lt;/code&gt;, served up by a simple nginx server block pointed to the static &lt;code&gt;index.html&lt;/code&gt; when navigating to &lt;code&gt;http://devenv.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;webpack-dev-server running, serving an in-memory version of the site over local port &lt;code&gt;8080&lt;/code&gt;. 

&lt;ul&gt;
&lt;li&gt;another nginx server block &lt;em&gt;using a subdomain such as&lt;/em&gt; &lt;code&gt;http://live-and-hmr.devenv.com&lt;/code&gt; which proxies the websocket connection over to the above webpack-dev-server process on &lt;code&gt;8080&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What I didn’t understand originally was that webpack-dev-server &lt;strong&gt;is a server&lt;/strong&gt; (duh) and as a result nginx should not be &lt;em&gt;doing the serving&lt;/em&gt; of that resource. It merely needs to step aside and hand off the responsibility to webpack-dev-server. This tripped me up, conceptually, before it clicked and prevented me from reasoning properly enough about the solution in order to arrive at it earlier.&lt;/p&gt;

&lt;p&gt;One wouldn’t have to use the two URLs (with and without the subdomain going to the static and dev-server versions) but I found it convenient to be able to work off the HMR dev-server version 90% of the time while keeping the convenience of building the site and flipping over to the static tab for a sort of more &lt;code&gt;productiony&lt;/code&gt; experience.&lt;/p&gt;

&lt;p&gt;I thought a bit about why there were so few Stack Overflow posts or blog article about this solution and I arrived at: The remote dev vps approach is relatively uncommon and it may be even less common among front end developers. This is a bit of an assumption and maybe a rude-ish one, but one which is grounded by this bias: Front-end-mostly devs are more likely to be spending their valuable time working on javascript/webpack/gulp/styling workflows, etc. - all of which are noble pursuits and beautiful, but its easy to spend much of your time in that world without having to worry about hosting details, nginx, processes/ports, and the like.&lt;br&gt;&lt;br&gt;
To be clear, this is not a value judgement. Quite the contrary; being a mostly-back-end-developer myself I started off with very little knowledge on the front end challenges listed above and I have a lot of respect for those who know this stuff inside and out.&lt;br&gt;&lt;br&gt;
It has been a long and rewarding journey for me.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;p&gt;Enough of my yakking! When I finally got the thing working I hastily noted it all down in a GitHub Gist (after doing a lot of wild, expletive-laced celebratory gesturing). The Gist will likely make enough sense to someone well-versed in webpack and its configuring, but I don’t know that its the clearest thing. Let me know if you have questions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/vcavallo/4f11985c4364bc4edfdf56556bff4ccf"&gt;Link to gist&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Embed (margins are off on dev.to. go to the source linked above..):&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Bonus for Rails + Webpacker users
&lt;/h2&gt;

&lt;p&gt;There’s another post forthcoming on Rails + Webpacker over VPS, but for now here’s another hastily-written gist with the solution for that setup (warning: it’s &lt;em&gt;weirder&lt;/em&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/vcavallo/22cac63d01e3b73a56a92a619c6ff698"&gt;Link to gist&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Questions, comments, concerns and ridicule all welcome below!&lt;/p&gt;

</description>
      <category>webpack</category>
      <category>vps</category>
      <category>javascript</category>
      <category>nginx</category>
    </item>
    <item>
      <title>Setting up Middleman and Tailwind CSS</title>
      <dc:creator>vinney cavallo</dc:creator>
      <pubDate>Wed, 06 Dec 2017 21:16:00 +0000</pubDate>
      <link>https://forem.com/vinneycavallo/setting-up-middleman-and-tailwind-css-4pap</link>
      <guid>https://forem.com/vinneycavallo/setting-up-middleman-and-tailwind-css-4pap</guid>
      <description>&lt;p&gt;Middleman and Tailwind make landing pages a breeze (get it?). Here’s how to get them to work together!&lt;/p&gt;

&lt;p&gt;I’m a big fan of the &lt;a href="https://middlemanapp.com/"&gt;Middleman&lt;/a&gt; static site generator and static sites / markdown blogs in general:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;My consultancy’s site, &lt;a href="http://exnil.io"&gt;exnil.io&lt;/a&gt; is built on Middleman.&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://blog.vinneycavallo.com/"&gt;My personal blog&lt;/a&gt; is built on &lt;a href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt; - a sort of cousin to Middleman.&lt;/li&gt;
&lt;li&gt;And this site you’re reading is &lt;a href="http://octopress.org/"&gt;Octopress&lt;/a&gt;, a kinda defunct Jekyll nephew. (used to be Octopress… Migrated to Jekyll in 2018)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lately I’ve been drinking the &lt;strong&gt;utility-first CSS&lt;/strong&gt; kool-aid with glee. As others before me have also noted, &lt;a href="https://adamwathan.me/css-utility-classes-and-separation-of-concerns/"&gt;Adam Wathan’s blog post&lt;/a&gt; makes the argument quite well, so I won’t get into my reasons here. Since I just mentioned Adam, it won’t be a surprise that my utility-centric CSS framework of choice at the moment is &lt;a href="https://tailwindcss.com/"&gt;Tailwind CSS&lt;/a&gt;, which he co-created (or “&lt;em&gt;is currently co-creating&lt;/em&gt;” since they are currently hard at work on the road to 1.0. And really when can the creation of any piece of software be in the &lt;em&gt;past tense&lt;/em&gt;?)&lt;/p&gt;

&lt;p&gt;I set out to build a pre-launch landing page for a new web app idea for which I am attempting to take a community pulse. I’m tentatively calling it &lt;a href="http://www.ratemyrefactor.com"&gt;Rate my Refactor&lt;/a&gt; and the point of it is to facilitate discussion and advice around specific instances of refactoring and code quality.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DDOJjfl2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://vcavallo.github.io/images/rmr-screenshot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DDOJjfl2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://vcavallo.github.io/images/rmr-screenshot.png" alt="Rate my Refactor screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The speed and friction-reduction afforded by both Tailwind and Middleman make their team-up a natural choice for a simple landing page. In an effort to hit the ground running I popped over to Google to find some direction on getting Middleman, Webpack, PostCSS and Tailwind to all play nicely together. (disclaimer, I’m traditionally a back-end developer so the unholy union of &lt;code&gt;npm/yarn/webpack/gulp/js/postcss/etc/etc&lt;/code&gt; doesn’t just come naturally to my fingertips.)&lt;/p&gt;

&lt;p&gt;I found a whole lot of nothing Googling around for this. Probably because most front-end devs come out of the womb knowing their way around yarn balls, gulps, and webby packs - but as I said, that’s not me. Apparently I’m not alone: &lt;a href="http://www.impostorroster.com/posts/cannot-understand-how-webpack-works"&gt;http://www.impostorroster.com/posts/cannot-understand-how-webpack-works&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So I figure there’s gotta be someone else out there looking for this answer.&lt;br&gt;&lt;br&gt;
Hello, someone! Here it is:&lt;/p&gt;

&lt;h1&gt;
  
  
  Show Me How To Do It Already!
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://github.com/vcavallo/middleman-and-tailwind"&gt;Here’s a GitHub repo all set up for you&lt;/a&gt;. These are the main bits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Middleman settings: 

&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;activate :external_pipeline&lt;/code&gt; line in &lt;code&gt;config.rb&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Webpack setup: 

&lt;ul&gt;
&lt;li&gt;settings for js and css in &lt;code&gt;webpack.config.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;the contents of &lt;code&gt;package.json&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Tailwind config: 

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;postcss.config.js&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tailwind.js&lt;/code&gt; (generated as directed in their installation docs)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As an added bonus, this repo also has the configs necessary for an easy Heroku deploy.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Final Product…
&lt;/h1&gt;

&lt;p&gt;I invite you to check out &lt;a href="http://www.ratemyrefactor.com"&gt;Rate my Refactor&lt;/a&gt; for an example of a basic Middleman+Tailwind+Heroku site. Since you’re reading a programming blog you probably care at least a little about refactoring - so why not sign up for the email list while you’re over there?!&lt;/p&gt;

&lt;p&gt;Thanks! If you have any improvements or problems please drop them in the comments below.&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>staticsite</category>
      <category>middleman</category>
      <category>howto</category>
    </item>
    <item>
      <title>Easily center content in vim</title>
      <dc:creator>vinney cavallo</dc:creator>
      <pubDate>Tue, 28 Mar 2017 20:38:14 +0000</pubDate>
      <link>https://forem.com/vinneycavallo/easily-center-content-in-vim</link>
      <guid>https://forem.com/vinneycavallo/easily-center-content-in-vim</guid>
      <description>&lt;h2&gt;
  
  
  Finding your center
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4a43naj5ks8eh43z1gi.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4a43naj5ks8eh43z1gi.gif" alt="vim centering gif" width="640" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was &lt;a href="http://vcavallo.github.io/blog/2017/02/28/vim-function-to-visually-center-a-plaintext-file/" rel="noopener noreferrer"&gt;originally posted on my programming blog&lt;/a&gt;.&lt;br&gt;&lt;br&gt;
I use vim for absolutely everything that I reasonably can. When editing code I typically have a vertical split with files open in both panes - so there is content across the whole screen. But when I'm writing non-code text I usually only have one file open and I like to keep an 80-column margin. This means I have a relatively narrow column of writing all the way on the left side of the screen and it feels and looks weird.&lt;br&gt;&lt;br&gt;
I like to get it centered left-to-right on my full-screen vim window. This is how I accomplish that.&lt;/p&gt;

&lt;p&gt;Check out the original post to learn more. For the impatient, here's a snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;" centers the current pane as the middle 2 of 4 imaginary columns
" should be called in a window with a single pane

 function CenterPane()
   lefta vnew
   wincmd w
   exec 'vertical resize '. string(&amp;amp;columns * 0.75)
 endfunction

" optionally map it to a key:
" nnoremap &amp;lt;leader&amp;gt;c :call CenterPane()&amp;lt;cr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me know if you find it to be broken in some situations or think it can be improved. Or better yet, if you found a better way to do the same!&lt;/p&gt;

</description>
      <category>vim</category>
      <category>markdown</category>
      <category>writing</category>
    </item>
    <item>
      <title>Hi, I'm vinney cavallo</title>
      <dc:creator>vinney cavallo</dc:creator>
      <pubDate>Tue, 14 Mar 2017 21:15:06 +0000</pubDate>
      <link>https://forem.com/vinneycavallo/hi-im-vinney-cavallo</link>
      <guid>https://forem.com/vinneycavallo/hi-im-vinney-cavallo</guid>
      <description>&lt;p&gt;I have been coding for 4 years.&lt;/p&gt;

&lt;p&gt;You can find me on Twitter as &lt;a href="https://twitter.com/vinneycavallo" rel="noopener noreferrer"&gt;@vinneycavallo&lt;/a&gt; and on &lt;a href="http://vinneycavallo.com" rel="noopener noreferrer"&gt;my site&lt;/a&gt; (which has any other links on me you'd need).&lt;/p&gt;

&lt;p&gt;I live in New York City (but moving to Providence shortly).&lt;/p&gt;

&lt;p&gt;I work for Myself! Currently building &lt;a href="https://walkup.io" rel="noopener noreferrer"&gt;WalkUp.io&lt;/a&gt; with a business partner.&lt;/p&gt;

&lt;p&gt;I mostly program in these languages: Ruby, bash, front-end web stuff as needed.&lt;/p&gt;

&lt;p&gt;I am currently learning more about discipline.&lt;/p&gt;

&lt;p&gt;Nice to meet you.&lt;/p&gt;

</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
