JavaScript without compiling

Yves Gurcan
3 min readNov 23, 2019

--

HTML5 to the rescue!

I’ve been using React for more than four years. Like most people in the JavaScript community, I enjoy using this library very much. React is a great fit for my single page applications.

React is easy to get to production: I clone my template repository, write my app, run a quick script to build the compiled code and… voilà. Thanks to Webpack and GitHub Pages, my project is almost instantly deployed. With a minimal amount of setup and a custom domain name, my app is published and ready.

If I need an endpoint, I will most likely use AWS to create a Lambda function behind API Gateway. Need a database? No problem, I can link the Lambda to DynamoDB.

I find this solution extremely fitting to my needs: it’s flexible, it does not require much configuration, it’s fast, and it works great for me. However, there still is something that gets in my way: if I want to update the code of my React app, I need to compile it after every change. Probably a detail for other developers? I’m not sure how other professionals see that issue. It might not be much of a hassle but it’s also nice to be able to make quick changes without having to re-build the app every time.

For example, when I notice a typo or a functionality that is not working because of a small bug in my app, I would like to just fix the offending line of code and have my GitHub Pages up to date as soon as I’m done with my edit. But, no, with React–or Vue, or any other JS library of the same kind–a problem that effectively takes you a second to resolve will also require that you re-compile. A small issue that can be annoying if you are on the go with a mobile device and only have the GitHub interface to commit to your repo.

I know, it doesn’t take that long to for your build script to run. And you should probably not use the GitHub web client to commit changes. But vanilla JavaScript allows developers to write code that is ready to go as soon as you reload the page. And, if it’s possible to commit to GitHub straight from your browser, why should you give up on this functionality?

That’s where I decided to go back to simple HTML, CSS, and minimal amount of JS. I just felt the need to go back to the roots of web technology and remember that it’s not always necessary to complicate projects with gigabytes of dependencies.

Good old static HTML. That’s how I wrote my personal website, at https://www.yvesgurcan.com. In fact, it turns out that this project actually has more CSS than HTML in it. Ironically, the stylesheets are written with SASS and, thus, require to be compiled–which only takes a second. And, yes, it would not have been hard to write ‘vanilla’ CSS instead.

But what I’m the most proud of is that only 10% of the code is JavaScript… and it feels good!

You should try it :)

--

--

Yves Gurcan

Founder of Parallel45. Senior Software Engineer. AWS Certified.