🎨 Minimal Vite + UnoCSS integration with Kirby

Overview

Kirby Vite UnoCSS Kit

A powerful and performant integration of Vite, UnoCSS and Kirby. This project seeks to provide a best practice that combines these three solutions while focusing on the development experience.

Key Features

  • ⚑️ Vite – HMR and all the bells and whistles
  • πŸ“‘ Module system inspired by Nuxt.js
  • πŸ’‘ On-demand template loading
  • πŸͺ„ Page reload on snippet/template changes
  • 🎨 UnoCSS – on-demand atomic CSS engine similar to Tailwind CSS
  • πŸ” SEO-friendly defaults
  • 🦾 TypeScript, of course

Why UnoCSS

tl;dr: Write your CSS like you prefer to and pull in only the utilities you need on top.

Let me cite Anthony Fu:

UnoCSS is an atomic-CSS engine instead of a framework. Everything is designed with flexibility and performance in mind. In UnoCSS, there are no core utilities; all functionalities are provided via presets.

By default, UnoCSS applies the default preset. Which provides a common superset of the popular utilities-first framework, including Tailwind CSS, Windi CSS, Bootstrap, Tachyons, etc.

For example, for this kit only the following utilities are generated:

.box{padding:1rem;margin-left:auto;margin-right:auto;--un-bg-opacity:1;background-color:rgba(244,244,245,var(--un-bg-opacity));border-radius:0.375rem;--un-shadow-color:0,0,0;--un-shadow:0 1px 2px 0 rgba(var(--un-shadow-color), 0.05);-webkit-box-shadow:var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow);box-shadow:var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow);max-width:7xl;}
.px-4{padding-left:1rem;padding-right:1rem;}
.py-4{padding-top:1rem;padding-bottom:1rem;}
.mx-auto{margin-left:auto;margin-right:auto;}
.mb-4{margin-bottom:1rem;}
.max-w-screen-md{max-width:768px;}

You may also want to give this blog post a read Reimagine Atomic CSS for the story behind.

Installation

  1. Duplicate the .env.example as .env and optionally adapt its values depending on your environment:
cp .env.example .env
  1. Install the required dependencies:
npm install
composer install

Configuration

To add custom rules or shortcuts, edit the unocss.config.ts.

For example, this project already defines a box class via a shortcut:

shortcuts: {
  'box': 'max-w-7xl mx-auto bg-gray-100 rounded-md shadow-sm p-4'
}

Usage

Development

  1. Build assets and watch for changes accordingly:
npm run dev
  1. Run the PHP built-in web server or use a development web server of your choice (like Laravel Valet).
composer start

Production

Build the frontend assets (CSS & JS files):

npm run build

If you have caching enabled, make sure to wipe the cache after each build:

rm -rf storage/cache/<your-website>

Deployment

  1. Deploy whole repository on your server.
  2. Duplicate .env.example as .env.
  3. Install dependencies:
    • npm install
    • composer install
  4. Build frontend assets:
    • npm run build
  5. Point your web server to the public folder.
  6. For Apache web servers: Some hosting environments require to uncomment RewriteBase / in .htaccess to make site links work.

License

MIT

You might also like...
A minimal package to help you make your laravel application cleaner and faster.
A minimal package to help you make your laravel application cleaner and faster.

Laravel Widgetize πŸŽ€ πŸŽ€ "cleaner code" βž• "easy caching" πŸŽ€ πŸŽ€ Built with ❀️ for every smart laravel developer πŸ”¦ Introduction What is a widget object

A minimal boilerplate theme for WordPress using TailwindCSS, with PostCSS and Laravel Mix.

A minimal boilerplate theme for WordPress using TailwindCSS, with PostCSS and Laravel Mix.

This is a white minimal wordpress theme

_s Hi. I'm a starter theme called _s, or underscores, if you like. I'm a theme meant for hacking so don't use me as a Parent Theme. Instead try turnin

Minimal Laravel authentication scaffolding with Blade and Tailwind.

Introduction Breeze provides a minimal and simple starting point for building a Laravel application with authentication. Styled with Tailwind, Breeze

A minimal library that defines primitive building blocks of PHP code.

Jungi Common A minimal library that defines primitive building blocks of PHP code. It combines the advantages of functional and object-oriented progra

A Simple MOFH clientarea for free like infinityfree and minimal functionality

Project Hustal Project Hustal is a free of cost MOFH clientarea for account management and support services. It have easy to use features and a much l

A minimal library that defines primitive building blocks of PHP code.

A minimal library that defines primitive building blocks of PHP code. It combines the advantages of functional and object-oriented programming. All of this makes code easier to understand and less prone to errors.

Personal Knowledge Management. Use branch "minimal change" to deploy as laravel package.

Knowfox Knowfox is my Personal Knowledge Management system. Having been an keen Evernote user since 2012, I finally got around to taking my precious n

A minimal package that helps you login with any password on local environments
A minimal package that helps you login with any password on local environments

Laravel Anypass Built with ❀️ for every "lazy" laravel developer ;) It is always painful to remember and type in the correct password in the login for

Minimal PHP MVC Framework that is eternally broken.

β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„ β–ˆβ–ˆ β–„β–„β–„ β–ˆ β–„β–„β–€β–ˆ β–„β–„β–ˆβ–ˆβ–„β–ˆβ–ˆ β–„β–€β–ˆβ–ˆβ–„β–ˆβ–ˆ β–„β–„β–€β–ˆ β–„β–„β–€ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆ β–„β–„β–€β–ˆβ–„β–„β–€β–ˆβ–ˆ β–„β–ˆ β–ˆ β–ˆβ–ˆ β–„β–ˆ β–€β–€ β–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–€β–€β–€ β–ˆβ–„β–„β–„β–„β–ˆβ–„β–„β–„β–ˆβ–„β–„β–„β–ˆβ–„β–„β–ˆβ–ˆβ–„β–„β–„β–ˆβ–„β–ˆβ–ˆβ–„β–ˆ

Simple and minimal yet another PHP 7 Framework

DemirApp Minimal PHP Framework Introduction Simple and minimal yet another PHP 7 Framework Features Simple routing Simple container (Dependency Inject

Minimal GraphQL client for Laravel.

Minimal GraphQL Laravel Client Minimal GraphQL client for Laravel. Requirements Composer 2+ Installation Install Package (Composer 2+) composer requir

🧬 Nano is a zero-config, no skeleton, minimal Hyperf distribution that allows you to quickly build a Hyperf application with just a single PHP file.

Nano is a zero-config, no skeleton, minimal Hyperf distribution that allows you to quickly build a Hyperf application with just a single PHP file.

PHP minimal MVC

This repository is probably the simplest version of an MVC system, useful for those who want to create a frameworkless project without sacrificing the convenience of the organization that guarantees the MVC pattern.

Minimal HTML login page that uses a json file as a database

JSONlogin Minimal HTML login page that uses a json file as a database Minimal login system that requires a new user to input username, password and th

πŸ—οΈ  Minimal PHP framework
πŸ—οΈ Minimal PHP framework

πŸ—οΈ Minimal PHP framework

Allows the use of the Vite.js next generation frontend tooling with Craft CMS
Allows the use of the Vite.js next generation frontend tooling with Craft CMS

Vite plugin for Craft CMS 3.x Allows the use of the Vite.js next generation frontend tooling with Craft CMS Related Article: Vite.js Next Generation F

CodeIgniter 3 + Vue.js 3 + Vite with supported Hot Module Replacement (HMR)

CodeIgniter 3 + Vue.js 3 + Vite Looking for Vue 2? Please check branch vue2 Just a basic example how to integrating CodeIgniter 3 + Vue.js 3 + Vite wi

Laravel Starter With Laravel, Vite, Vue 2, Inertia.js, Ziggy

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Comments
  • Syntax Highlighting for UnoCSS in VS Code?

    Syntax Highlighting for UnoCSS in VS Code?

    Hi, thank you very much for this template. The only thing i missed, is the syntax highlighting for unocss inside my .php files. Do you find a way to get this working without breaking the php syntax?

    opened by niklasgrewe 2
Owner
Johann Schopplich
Web designer/developer. Pharmacist prior to that.
Johann Schopplich
Tabulation System using Laravel 9, Vue 3, and Vite. #100DaysOfCode

Tabulation System using Laravel 9, Vue 3, and Vite. #100DaysOfCode

Arvic S. Babol 3 Apr 14, 2022
REDAXO Watson Search integration for searching inside Yrewrite redirections

yrewrite_watson_search REDAXO Watson Search integration for searching inside Yrewrite redirections Usage Keyword 'forward'. Example 'forward conversio

Oliver HΓΆrold 5 Nov 2, 2022
A slim, lean forum package designed for quick and easy integration in Laravel projects

Complete documentation is available on teamteatime.net. Installation Requires Laravel 6+ and PHP 7.4+. Step 1: Install the package Install the package

TeamTeaTime 486 Dec 31, 2022
Integration of the popular Bootstrap CSS framework for CodeIgniter 4

Tatter\Bootstrap Integration of the popular Bootstrap CSS framework for CodeIgniter 4 Description This library leverages Tatter\Assets to automate ass

Tatter Software 1 Nov 27, 2021
Plugin Vite is the conduit between Craft CMS plugins and Vite, with manifest.json & HMR support

Plugin Vite Related Articles: Vite.js Next Generation Frontend Tooling + Craft CMS A Vite Buildchain for Craft CMS Plugins Requirements Craft CMS 3.0.

nystudio107 8 Dec 30, 2022
Plugin for Kirby that allows you to load assets generated by Vite.

Kirby Vite Plugin Plugin for Kirby that allows you to load assets generated by Vite. In development mode, assets are loaded from Vite's development se

Oblik Studio 10 Nov 20, 2022
Perch Dashboard app for exporting content to (Kirby) text files and Kirby Blueprint files

toKirby Perch Dashboard app for exporting content to (Kirby) text files and Kirby Blueprint files. You can easily install and test it in a few steps.

R. Banus 4 Jan 15, 2022
This Kirby V3 Plugin brings snippets and blueprints together in one place. It includes useful tools that completely changing the way you work with Kirby: Fast and well organized.

Kirby Components Overview Do you love to make awesome projects with Kirby CMS? Do you also find it difficult to switch between snippets and blueprints

Roman Gsponer 6 May 31, 2023
Integration with your Symfony app & Vite

ViteBundle : Symfony integration with Vite This bundle helping you render all of the dynamic script and link tags needed. Essentially, he provide two

Hugues Tavernier 84 Dec 21, 2022
Vite integration for WordPress plugins and themes development.

Vite for WordPress Vite integration for WordPress plugins and themes development. Usage Let's assume we have this plugin files structure: my-plugin/ β”œ

Dzikri Aziz 48 Jan 2, 2023