July 15, 2022

🚀 Style your Vue website faster with Stylify CSS

Style your Vue website faster and intuitively with Stylify.

Stylify + Vue + Vite. Style your Vue website faster with Stylify. Don't study selectors, syntax and documentation. Use pure CSS syntax and get generated CSS with advanced optimization for production.

For an easier start, you can check out the Stylify Stackblitz playground 🎮.

💎 Stylify CSS Introduction

Stylify generates CSS dynamically based on what you write. The syntax is similar to css property:value. Defined utilities are combined with components selectors and in production minified to bare minimum like .color\:red,.button {color:red} to ._zx,._ga{color:red}.

Stylify allows you to get very small bundles, generate additional lazyloaded CSS chunks, and style the page by writing HTML and selectors 🤟.

🚀 Vue.js Setup

The easiest way to Setup the Vue is using cli:

  • Run yarn create vite app
  • Select vue
  • Then cd app

This way you will get the default Vue application skeleton.

🔌 Stylify CSS Integration

Install the @stylify/unplugin package using NPM or Yarn:

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

Open the vite.config.js and copy the following content into it:

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { stylifyVite } from '@stylify/unplugin';

const stylifyPlugin = stylifyVite({
    bundles: [
            files: ['./src/**/*.vue'],
            outputFile: './src/assets/stylify.css',

export default defineConfig(() => ({
    plugins: [stylifyPlugin, vue()]

In the last step, open the src/main.js and add the path to stylify.css:

// ...
import './stylify.css'

Styling the website

If you copy the code bellow into the src/App.vue and run yarn dev you will get a styled Hello World! 🎉 text:

  <div class="max-width:800px margin:0_auto">
    <h1 class="text-align:center margin-top:100px font-size:42px">Hello World!🤩</h1>

Stylify watches any change in the files that matches the mask in the bundle files and generates CSS into the src/stylify.css.

If you add for example color:blue, the CSS will be automatically updated 🎉.

Go ahead and try Stylify CSS directly on Stackblitz.com 💡.


To avoid bloated templates with utilities, you can use components directly in files, where they are used through content options (expects javascript object without brackets) or in the compiler config.

  container: 'max-width:800px margin:0_auto',
  title: 'text-align:center margin-top:100px font-size:42px'
  <div class="container">
    <h1 class="title">Hello World!🤩</h1>


If you like clean code, you also want to avoid hardcoded values in selectors. Variables can be defined the same way as components:

  titleFontSize: '42px',
  containerWidth: '800px'

  container: 'max-width:$containerWidth margin:0_auto',
  title: 'text-align:center margin-top:100px font-size:$titleFontSize'
  <div class="container">
    <h1 class="title">Hello World!🤩</h1>

Building for production

If you run yarn build + yarn preview, the vue markup will be mangled to this:

  <div class="_7tcrv">
    <h1 class="_88io">Hello World!🤩</h1>

The css is shortened too:

:root {--titleFontSize: 42px;--containerWidth: 800px;}
._m0vnad,._7tcrv{margin:0 auto}

Configure anything you need

The examples above doesn't include everything Stylify CSS can do:

Feel free to checkout the docs to learn more 💎.