Running PHP CS Fixer on every commit with husky and lint-staged

| 2 min read

Last month, I wrote a post about automatically running prettier before every commit. This ensures that all JavaScript and CSS are formatted correctly before they’re stored in the project’s repository.

Husky and lint-staged have been working hard keeping our front-end assets clean as Spatie, so we decided to expand their responsibilities to keep our PHP files clean too. This is a modified version of my previous post using PHP CS Fixer instead of prettier. There’s also an example of a conmbined configuration to run prettier and PHP CS Fixer simultaneously at the end of the post.

Read more


Web components

| 5 min read

Every now and then, web components hype seems to resurface. Judging by my Twitter feed, it’s a bull market period now. Seems like a good time to share some thoughts.

Read more


Why I prefer React over Vue

| 5 min read

Vue is the default JavaScript framework for Laravel apps. Being part of the Laravel community, I often get the question why I prefer React, so I’ve decided to write down a few standout reasons.

Read more


Don’t forget to be selfish every now and then

| 1 min read

The other day, I stumbled upon an older article by DHH. “Work on what you use and share the rest”.

My core philosophy about open source is that we should all be working on the things that we personally use and care about. Working for other people is just too hard and the quality of the work will reflect that. But if we all work on the things we care about and then share those solutions between us, the world gets richer much faster.

I’ve been keeping this in the back of my mind the past few months.

I was always adding features because I’d expect other people to expect them. It’s a trap! You’re not making people happier by guessing what they might need. You’re not doing anyone a disservice by building things for yourself.

Building things for yourself makes it easier to ship something you feel happy about. It makes it easier to ship something at all.

Don’t forget to be selfish as an open source maintainer every now and then. It’s a good investment in the long run.

I used to fall in the trap of thinking I needed to add features because other people might expect them to be a part of my code, not because I need them myself.


Keep your assets Prettier on every commit

| 1 min read

I’m a happy prettier user to keep my CSS and JavaScript files consistent. However, it’s hard to keep the discipline to run Prettier before every commit. This week I decided to automate the process with Husky and lint-staged.

Read more


The great divide

Chris Coyier consolidated an array of opinions about what it means to be a frontend developer today.

On one side, an army of developers whose interests, responsibilities, and skill sets are heavily revolved around JavaScript.

On the other, an army of developers whose interests, responsibilities, and skill sets are focused on other areas of the front end, like HTML, CSS, design, interaction, patterns, accessibility, etc.

It’s that other side that seems to really be feeling this divide. A quote from Mandy Michael:

What I don’t understand is why it’s okay if you can “just write JS”, but somehow you’re not good enough if you “just write HTML and CSS”.

When every new website on the internet has perfect, semantic, accessible HTML and exceptionally executed, accessible CSS that works on every device and browser, then you can tell me that these languages are not valuable on their own. Until then we need to stop devaluing CSS and HTML.

A lot of these excerpts really hit home. I’m looking forward to the conversation this might spark.

Read the full piece on css-tricks.com.


An introduction to Phoenix LiveView

The last year or two, I’ve been playing around with Elixir. Chris McCord, author of the Phoenix web framework, is working on a new feature for Phoenix: LiveView.

Phoenix LiveView is an exciting new library which enables rich, real-time user experiences with server-rendered HTML. LiveView powered applications are stateful on the server with bidrectional communication via WebSockets, offering a vastly simplified programming model compared to JavaScript alternatives.

In short, LiveView enables you to enable interactive, real-time app, without touching any JavaScript, as the application logic lives on the server.

LiveView looks like an interesting alternative to the current SPA trend. You can read Chris’ entire walkthrough on dockyard.com. Even if you’re not familiar with Elixir yet, LiveView’s proposed programming model is an interesting topic on it’s own.


Everyone has JavaScript, right?

I used to think disabled JavaScript went hand in hand with visitors explicitly blocking it. I came to the conclusion that I don’t necessarily need to cater to that crowd, because the degraded user experience was by choice. After reading through this chart, I realized how wrong I was.

Sometimes your JavaScript just won’t work. Be prepared.

Read the flowchart on kryogenix.org.


Hindsight 2018 edition

| 1 min read

Well since you asked, Mohamed 🙃, a little retrospective on this past year…

Read more


Not all code is the same

As a short follow-up to Everyone has JavaScript, right?, there’s more to JavaScript than availability, there are also the performance implications.

I don’t think most people are saying, “don’t use JavaScript.” That would be absurd.

But use less, use it wisely, and don’t depend on a giant framework for simple stuff. Use as little JS as possible to get the experience you want. You can do that and still have a great, immersive app.

I believe we’re reaching for JavaScript more often because of its ecosystem, not because it’s the better solution. The JavaScript ecosystem simply has incredible tools to build interfaces, and I hope server side solutions will still be able to compete.

I don’t have a conclusion ready, I’m just interested in the topic. To be explored in 2019. Meanwhile, read Chris Ferdinandi’s thoughts on the matter.