Category: Laravel, Laravel

We’re going to see how to obfuscate Tailwind classes, or CSS classes in general, in a Laravel project so that no one is able to simply copy and paste your classes and steal your work. The goal is to transform class="bg-indigo-500 flex flex-col h-full" to something like class="h N T ja".

Configuring the plugi n in Laravel’s Mix is easy. The key point here is to save the class mappings to a Laravel config file, which we will use later on.

You may simply map your classes by calling config('map.bg-indigo-500'), and you’re ready to go but hey, it’s kind of problematic if you need to wrap all your classes like that, it also does not consider the environment.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners