allenjd3 a place to set on

Carrots

Coding can be an art form. Many folks get all wrapped up in the elegance of well designed code. It doesn’t take long when diving into a new piece of code to see whether it was well designed and well thought out, or if I coded it. (Only kidding- kind of…) Laravel’s tagline is “The PHP Framework for Web Artisans.” It’s aptly named, if a little pretentious. You can create really beautiful code with laravel. You can create beautiful code with Ruby on Rails, or nodejs. And then there is wordpress.

Don’t get me wrong. Wordpress is the engine behind the web. It drives a large portion of blogs, businesses and ecommerce solutions. It does it quite well also and is fairly user-friendly in the admin panel. The code is ugly though…

Case in point-

<?php 
if ( have_posts() ) : 
while ( have_posts() ) : the_post(); 
    // Display post content
endwhile; 
endif; 
?>

The dreaded “loop”. You have to put this bad boy everywhere. And what is with all of these functions? I guess PHP didn’t have classes when wordpress was built? No wait, I know there were classes because of the “walkers.” No we aren’t talking about the AMC TV show The Walking Dead. These are classes that you have to extend in order to make changes to the html output of navigation or comments. Then there are the inline image styles… Makes me shudder to think about it.

This is the reason I started looking for another solution. That’s when I found roots/sage. This is a theme that uses a lot of the things I love about Laravel and incorporates them into Wordpress development. It lets you do things like this-

@extends('layouts.base')

@section('content')
  @while(have_posts())
  {!! the_post() !!}
  @include('partials/content-single')
@endwhile
@endsection

Ahhh, that’s better… I happily installed it and typed yarn start and wah wah waaahhh. It failed! It tried to build out node-sass but was unable to complete the task. (I’m using version 9 of sage btw, this is fixed in version 10) So I messed around for a long time trying to figure out the issue. I looked at my version of Node. (It was a little old so I updated). Still no-go. I upgraded my version of windows build tools. Nada. I was about to give up until I dug into the node-sass github readme and noticed this little gem-

Supported Nodejs Versions-

Node 14 	4.14+ 	83
Node 13 	4.13+ 	79
Node 12 	4.12+ 	72
Node 11 	4.10+ 	67
Node 10 	4.9+ 	64
Node 8 	4.5.3+ 	57

In the package.json- version 9 is set to ~4.9 and I had node version 14… Tah Dah! I changed the version from ~4.9 to ^4.9 and boom- sweet roots/sage magic commenced. From then on, I danced around in beautiful blade templates and went to sleep dreaming of partials and layout files.

;TLDR If you are trying roots/sage and come across an error about node-sass, you likely aren’t using a supported version of node.

New Blog. Again.

So I’m making a new blog, again. I know, I make a new blog more than flies on a dog turd. So why am I starting again you may ask? Its simple. I’m bored. I also just want the freedom to write without having to worry about whether my theme is rendering it properly. That’s where jekyll comes in.

Jekyll is pretty well known in github land. Its the default static site builder for github. I say this only having learned about this today. Yes, I had heard about jekyll but I never put two and two together. I started out making my github static sites using jigsaw which is a php static site builder. There’s nothing wrong with jigsaw by the way. I’m just someone thats always learning about the next thing. Or the last thing depending on when I learn about the existance of something. What were we talking about again?

Anyways,

I thought, I wonder if ruby has a jigsaw? So I google search ruby static site generator and see jekyll. Then all my memory bells start jingling and I remember all the times I’ve heard about jekyll in the past and thought, what'ev. Instead, today I thought- ev and gave it a shot.

Jekyll is pretty cool. The theming seems a bit fiddly but its probably because it looks like they recently changed how you can install themes. Now your theme is just a gem file. This makes it pretty easy to install new themes and less easy to make new themes. Which is the real reason I didn’t change my theme from the default.

To be fair, I did start changing it and thought,

naw that default theme is pretty slick and ain’t nobody got time for that.

I wrote this blog entirely as it came to my brain so sorry ‘bout that. I’m not going to do one of those how-to things today. Here are the docs if you want to read them- Jekyll Docs. Until next time.