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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners