Draft Blog Post
I was pretty happy with how my dotfiles looked and worked, but after watching this video, I knew I had to give what Bartek Spitza did a try!
The Paradigm Shift
Most people (myself included) others think of dotfiles as just a copy paste of our literal dotfiles. But no machine is the exact same and sometimes you want to experiment, without screwing up other setups.
However, what Bartek proposes we do is actually take a hint from the Javascript Ecosystem. Theres a lot of frameworks out there nowadays that offer a npm create xyz
command. This command would then ask you:
- What template do you want to use?
- Do you want typescript?
- Do you want eslint and/or prettier?
- What database do you want?
- What styling system do you want?
The end result is a bespoke config file for your project.
Some frameworks like astro (though gatsbyjs did it first), even give you the option to run commands like this to add features/options after the fact and it will modify your config for you.
In the case of tailwind, it modifies the astro config, creates a tailwindcss config file preconfigured for astro. It might even recognize if you’re using react/vue/svelte and add those file extensions to the tailwind config.
This is exactly what Bartek did in his video. He created a script with a setup wizard that generates his config file. Each device has their config file that is not committed to the dotfiles repository.
Updating dotfiles goes from backing up your config files to updating a cli wizard.
A side effect of this process is that Environment Variables can simply live in your main config file.