Corys Blog

Starting Something New...

by Cory on July 22, 2019 2:56 AM

I quit my fucking job! I almost have a new job, maybe. I might have about a month for a nice vacation.

I haven't been keeping up with my projects during the job hunt and I fell off the meditation wagon really hard. I'm in a much better place mentally than I was for the past six months, but I think trying to keep a (loose) routine might be good for me. Incidentally,  I've also come to the conclusion that trying to organize my projects into a rigid narrative that has a beginning, middle, and end for every single thing I do is causing me stress and just isn't working.

I've decided to just fuck around and be more open to starting things and dropping them if I lose interest or aren't useful. This might require me to reformat my website. Coincidentally, one of the things I have a sudden urge to do is to start learning front-end web design stuff.

I am picking up react js. Reading and experimenting with it so far is really cool. I didn't know beforehand that it was developed at facebook. I'm seriously impressed with how well thought out and practical it is. I also started combining it with django, which requires building up an entire toolchain involving webpack, a framework that lets you take unoptimized assets (js, css, html, images, etc) and minify them into smaller consolidated "bundles, and babel, another framework that compiles newer unsupported javascript into legacy javascript.

My modified stack basically looks the same up until we get to the front end. There's django, on top of heroku with S3, postgres, etc. Then on my end, I have webpack configured to take react libraries and babel to combine all my JS files. I insert them into my django views by using the django-webpack-loader django app. This takes the webpack output and let's me insert it into an html template using a templatetag. Basically where ever I would put a <script src="asdf.js" />, I use this webpack bundle template tag.

I used this article about integrating webpack, react, and django as a rough guideline. Before reading this though, I had to go through the webpack getting started tutorial and then combining that with the configuration for django-webpack-loader. Everything went pretty smoothly except for installing babel over npm. For some reason, they recently renamed a bunch of their packages and it really fucked some shit up.

The guide will tell you to install babel packages like this:

npm install --save-dev babel-core babel-loader babel-preset-env babel-preset-react

But they changed the babel core and babel preset package names. So use this instead:

npm install --save-dev @babel/core babel-loader @babel/preset-env @babel/preset-react

Anyway, that should work as of 07/22/19.

Getting into front-end bullshit is always overwhelming but I'm slowly getting the hang of it. There's so many random packages and things you need to setup and get working together, but I think I've settled on a stack that's working for me.

This Thought is part of Corys Blog

Welcome to the fucked up mind of Cory Parsnipson

back to the