Using Stylify CSS in Laravel Framework

Laravel is a PHP web application framework with expressive, elegant syntax.

Stylify can be integrated into the Laravel using the Stylify CSS Vite plugin.

Integration example for the Laravel framework can be found in integrations examples repository.

How to integrate the Stylify CSS into the Laravel Framework

First install Stylify unplugin:

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

Open the vite.config.js and add the Stylify CSS Plugin:

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

const stylifyPlugin = stylifyVite({
	bundles: [{ files: ['resources/views/**/*.blade.php'], outputFile: 'resources/css/stylify.css' }],
	// Optional -
	compiler: {},

export default defineConfig(({ mode }) => ({
	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:


Now when you run dev command in package.json, the CSS will be generated. When you run build, the CSS will also be mangled.

For older vesions of Laravel with Webpack

First, install the @stylify/unplugin package using NPM or Yarn:

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

Next add Stylify CSS plugin into the webpack.mix.js:

const { stylifyWebpack } = require('@stylify/unplugin');

const stylifyPlugin = stylifyWebpack({
	bundles: [{
		outputFile: './resources/css/homepage.css',
		files: ['./resources/views/welcome.blade.php']
	// Optional
	// Compiler config info
	compiler: {
		variables: {},
		macros: {},
		components: {},
		// ...

	mode: 'development',
	plugins: [stylifyPlugin]

Now you can use the commands for laravel mix.

Where to go next?