Lädt...


🔧 Stylify CSS: Code your Laravel website faster with CSS-like utilities


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

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

Introduction

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 purge needed
  • 🚀 Components, Variables, Custom selectors
  • 📦 It can generate multiple CSS bundles

Installation

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 - https://stylifycss.com/docs/unplugin
    compiler: {
        // https://stylifycss.com/docs/stylify/compiler#variables
        variables: {},
        // https://stylifycss.com/docs/stylify/compiler#macros
        macros: {},
        // https://stylifycss.com/docs/stylify/compiler#components
        components: {},
        // ...
    }
});

export default defineConfig(() => ({
    plugins: [
        stylifyPlugin,
        laravel({
            // 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:

<head>
    @vite('resources/css/stylify.css')
</head>

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

Usage

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>
.a{text-align:center}
.b{font-size:48px}
.c{color:blue}

Integration example

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

Configuration

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

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

...

🔧 Stylify CSS: Automagic CSS bundles splitting into CSS layers in Astro.build


📈 50.51 Punkte
🔧 Programmierung

🔧 Using Beautiful Material Themes from Material Theme Builder in Stylify CSS


📈 37.04 Punkte
🔧 Programmierung

🎥 Deploy Laravel with Github Actions - Part 45 | Laravel Social Media Website


📈 30.16 Punkte
🎥 Video | Youtube

🎥 Project setup with Laravel Sail - Part 1 | Laravel Social Media Website


📈 30.16 Punkte
🎥 Video | Youtube

🔧 Introduction of CSS, What is CSS, Why we use CSS and How CSS describe the HTML elements


📈 26.93 Punkte
🔧 Programmierung

🔧 Faster Pandas: Make Your Code Run Faster and Consume Less Memory || Miki Tebeke


📈 26.71 Punkte
🔧 Programmierung

🔧 🚀 Boost Your Laravel Performance with Real-Time Laravel N+1 Query Detection! 🛠️


📈 26.45 Punkte
🔧 Programmierung

🔧 Laravel 10 + NGINX + PHP-FPM - my ready to use all in one recipe for your Laravel 10 deployment in Docker


📈 26.45 Punkte
🔧 Programmierung

🔧 Laravel Boiler Template: Elevate Your Laravel Experience


📈 26.45 Punkte
🔧 Programmierung

🎥 Create Home Page UI with Tailwind.css - Part 4 | Laravel Social Media Website


📈 25.33 Punkte
🎥 Video | Youtube

🎥 Create User Profile Page UI with Tailwind.css - Part 5 | Laravel Social Media Website


📈 25.33 Punkte
🎥 Video | Youtube

🔧 How to Optimize Your CSS Code for Faster Web Pages


📈 23.64 Punkte
🔧 Programmierung

🔧 Dynamic Report Generation in Laravel: Introducing `laravel-dynamic-report-generator`


📈 23.13 Punkte
🔧 Programmierung

🕵️ CVE-2024-29291 | Laravel Framework 8/9/10/11 storage/logs/laravel.log information disclosure


📈 23.13 Punkte
🕵️ Sicherheitslücken

🔧 Laravel-10 Laravel-11 comparison, changes


📈 23.13 Punkte
🔧 Programmierung

🔧 Laravel: Pengenalan Fitur Reverb Di Laravel


📈 23.13 Punkte
🔧 Programmierung

🎥 Build and Deploy Real Time Messaging App with Laravel and React (with Laravel Reverb)


📈 23.13 Punkte
🎥 Video | Youtube

🔧 A guide to feature flags in Laravel using Laravel Pennant


📈 23.13 Punkte
🔧 Programmierung

🔧 Laravel - Unlock the Power of Laravel Gates for Simplified Authorization


📈 23.13 Punkte
🔧 Programmierung

🎥 Laravel 11 Crash Course - Laravel in 1 hour


📈 23.13 Punkte
🎥 Video | Youtube

🎥 Customize Error Views in Laravel #laravel #php #laravelhint #thecodeholic


📈 23.13 Punkte
🎥 Video | Youtube

🎥 I built $7,000 Laravel Project for YouTube #laravel #laravelproject #laravelframework


📈 23.13 Punkte
🎥 Video | Youtube

🔧 Understanding Laravel Middleware: A Deep Dive into Laravel 11's New Approach


📈 23.13 Punkte
🔧 Programmierung

🎥 I built $7000 Laravel Project #laravel #laravelproject #laraveldeveloper #laravelframework


📈 23.13 Punkte
🎥 Video | Youtube

🔧 update laravel 8 to laravel 11


📈 23.13 Punkte
🔧 Programmierung

🎥 I Built Laravel 10 Blog with Admin Panel #laravel


📈 23.13 Punkte
🎥 Video | Youtube

🔧 Simplifying API responses in Laravel with kolirt/laravel-api-response package


📈 23.13 Punkte
🔧 Programmierung

🕵️ Low CVE-2019-17494: Laravel-bjyblog project Laravel-bjyblog


📈 23.13 Punkte
🕵️ Sicherheitslücken

🔧 Hosting a simple Laravel application using Turso on Laravel Forge


📈 23.13 Punkte
🔧 Programmierung

🕵️ Low CVE-2019-17433: Laravel-admin Laravel-admin


📈 23.13 Punkte
🕵️ Sicherheitslücken

🔧 How to Build an API with Laravel Breeze in Laravel 11


📈 23.13 Punkte
🔧 Programmierung

🔧 Laravel Reverb: Fitur Websocket Server pada Laravel 11


📈 23.13 Punkte
🔧 Programmierung

matomo