December 8, 2022

Code your Laravel website faster with Stylify CSS

Code your Laravel website faster with Stylify CSS-like utilities. Don't study CSS framework. Focus on coding.


Stylify is a library that uses CSS-like selectors to generate optimized utility-first CSS based on what you write.

  • ✅ CSS-like selectors
  • ✅ No framework to study
  • ✅ Less time spent in docs
  • ✅ Mangled & Extremely small CSS
  • ✅ No CSS purge needed
  • ✅ Components, Variables, Custom selectors
  • ✅ It can generate multiple CSS bundles

Also we have a page about what problems Stylify CSS solves and why you should give it a try!


This article uses Laravel with Vite. For older versions with Webpack, check out this guide.

Install Stylify using CLI:

npm i -D @stylify/unplugin
yarn add -D @stylify/unplugin

Add the following configuration into vite.config.js:

import { defineConfig } from 'vite';
import { stylifyVite } from '@stylify/unplugin';

const stylifyPlugin = stylifyVite({
	// You can define multiple bundles, This example uses only one for simplicity
	bundles: [{ files: ['resources/views/**/*.blade.php'], outputFile: 'resources/css/stylify.css' }],
	// Optional -
	compiler: {
		variables: {},
		macros: {},
		components: {},
		// ...

export default defineConfig(() => ({
	plugins: [
			// Add path to generated files
			input: ['resources/js/app.js', 'resources/css/stylify.css'],
			refresh: true,

Add the path to resources/css/stylify.css into the template:


In case you define more than one bundle in stylifyVite plugin, make sure to import generated CSS files on correct pages.


Stylify syntax is similar to CSS. You just write _ instead of a space and ^ instead of a quote.

So if we edit the resources/views/welcome.blade.php:

<div class="text-align:center font-size:48px color:blue">Stylify + Laravel = 🚀</div>

In production, you will get optimized CSS and mangled HTML:

<div class="a b c">Stylify + Laravel = 🚀</div>

Integration example

You can also check out our Laravel integration example on Github.


The examples above don’t include everything Stylify can do:

Feel free to check out the docs to learn more 💎.

Give as Feedback!
Do you like Stylify CSS? Let us know by starring our repo!