GeistHaus
log in · sign up

Getting Started with Git Hooks and Husky

git-tower.com

In this fun tutorial, let's see how Git hooks work by creating 5 different hooks with Husky, a popular JavaScript package.

1 page links to this URL
How to set up Prettier On a Laravel App, Linting Tailwind Class Order and More

It may seem silly, but it's important to me that my Tailwind classes are orderedly consistently, and I don't want to have to manage that manually. Frustratingly, I've never found a solution that gives me exactly what I want—until now. Here's my must-have list: Works in CLI/Continuous Integration (Rustywind would work here, but not Headwind) Works in all IDEs (so Headwind doesn't cut it, and Rustywind would require work to adapt) Uses Tailwind's official ordering specifications (again, Headwind/Rustywind would require work to get here) Works on Laravel Blade files I've asked on Twitter multiple times, and the most recent time I asked, I got a response from my friend Jason Beggs suggesting I should look into prettier-plugin-blade. So I set out, with Jason's help, to get it working on a new Laravel app, later receiving some help from the tools' creator, John. What I found is that the ideal solution to my wish list above is using prettier-plugin-blade together with Tailwind's official Prettier plugin. It works on CI and the CLI, has IDE integrations, works in Blade files, and uses Tailwind's official class ordering. Let's dig in! The installation Install prettier, prettier-plugin-tailwindcss, and prettier-plugin-blade with npm install npm install --save-dev prettier-plugin-blade@^2 prettier prettier-plugin-tailwindcss Add a .prettierrc config file to your project root Here is the most basic file you'll start with, before you start actually configuring Prettier: { "plugins": ["prettier-plugin-blade", "prettier-plugin-tailwindcss"], "overrides": [ { "files": [ "*.blade.php" ], "options": { "parser": "blade" } } ] } On top of this, you can add your own lines to configure Prettier; here are those I've added, but you can find more here. { "printWidth": 120, "semi": true, "singleQuote": true, "tabWidth": 4, "trailingComma": "all", "plugins": ["prettier-plugin-blade", "prettier-plugin-tailwindcss"], "overrides": [ { "files": [ "*.blade.php" ], "options": { "parser": "blade" }

0 inbound links article en