Skip to content

About

Edit styles in the browser. Changes go straight to your source files.

Resources

Contributing

Stars

6 stars

Watchers

1 watching

Forks

Repository files navigation

LiveStyleSync

Edit styles in the browser. Changes go straight to your source files.

Click any element → tweak in the panel → Vite HMR updates the browser instantly. No copy-pasting between DevTools and your editor.


Install

Vite / Vue / Nuxt / SvelteKit / Astro / Solid:

npm install livestylesync-overlay livestylesync-vite-plugin

Next.js:

npm install livestylesync-overlay livestylesync-nextjs

Setup

React / Vite

// vite.config.ts
import { liveStyleSync } from "livestylesync-vite-plugin";

export default defineConfig({
  plugins: [liveStyleSync()],
});
// src/main.tsx
import { mount } from "livestylesync-overlay";

if (import.meta.env.DEV) {
  mount();
}

Next.js 14+

// next.config.ts
import { withLiveStyleSync } from "livestylesync-nextjs";

export default withLiveStyleSync({
  // ...your existing Next.js config
});
// app/layout.tsx  (or pages/_app.tsx)
import { Overlay } from "livestylesync-overlay";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html>
      <body>
        {children}
        {process.env.NODE_ENV === "development" && <Overlay />}
      </body>
    </html>
  );
}

Works with both App Router and Pages Router. Turbopack (--turbo) is not yet supported.


Vue 3 / Vite

// vite.config.ts
import { liveStyleSync } from "livestylesync-vite-plugin";

export default defineConfig({
  plugins: [vue(), liveStyleSync()],
});
// src/main.ts
import { mount } from "livestylesync-overlay";

if (import.meta.env.DEV) {
  mount();
}

Works with both <style scoped> and plain CSS/SCSS imports.


Nuxt 3

// nuxt.config.ts
export default defineNuxtConfig({
  vite: {
    plugins: [liveStyleSync()],
  },
});
// plugins/livestylesync.client.ts
export default defineNuxtPlugin(() => {
  if (import.meta.dev) {
    import("livestylesync-overlay").then(({ mount }) => mount());
  }
});

SvelteKit

// vite.config.ts
import { liveStyleSync } from "livestylesync-vite-plugin";
import { sveltekit } from "@sveltejs/kit/vite";

export default defineConfig({
  plugins: [sveltekit(), liveStyleSync()],
});
// src/app.html or src/routes/+layout.ts
if (import.meta.env.DEV) {
  const { mount } = await import("livestylesync-overlay");
  mount();
}

Astro

// astro.config.mjs
import { liveStyleSync } from "livestylesync-vite-plugin";

export default defineConfig({
  vite: {
    plugins: [liveStyleSync()],
  },
});
// src/layouts/Layout.astro (client:only)
<script>
if (import.meta.env.DEV) {
  const { mount } = await import("livestylesync-overlay");
  mount();
}
</script>

Solid.js / Vite

// vite.config.ts
import { liveStyleSync } from "livestylesync-vite-plugin";
import solid from "vite-plugin-solid";

export default defineConfig({
  plugins: [solid(), liveStyleSync()],
});
// src/index.tsx
import { mount } from "livestylesync-overlay";

if (import.meta.env.DEV) {
  mount();
}

Options

liveStyleSync({ port: 3100 })      // Vite plugin — default port
withLiveStyleSync({}, { port: 3100 }) // Next.js plugin — default port
mount({ port: 3100 })              // Overlay — must match

Both sides must use the same port. Change only if 3100 is taken.


Features

Feature Description
Element picker Click any element to inspect it
Element search Find elements by .class, #id, or CSS selector with live highlight
DOM breadcrumbs Navigate parent/child elements
Pseudo-state tabs Edit :hover, :focus, :active styles
Responsive tabs Edit @media breakpoint styles
Container query tabs Edit @container rules
CSS custom properties Browse and edit :root variables
SCSS $variables Scan and edit $var declarations across all SCSS files
Create new rules Add CSS to unstyled elements from scratch
Session history Git-style diff of all changes, undo by batch
Restore batches Click any past batch to restore it
Export diff Copy the full session diff to clipboard
Draggable & resizable Position the panel anywhere on screen
Keyboard shortcuts Alt+S toggle panel, ↑↓ nudge numbers (±1 / Shift ±10 / Alt ±0.1)
Color picker Native color picker for color/background/border properties
Tailwind detection Warns when the element uses Tailwind utilities
Instant preview Changes apply visually before saving
Write to source Patches the exact rule in your file, HMR picks it up

CSS format support

Format Read Patch
Plain .css ✅ ✅
.scss ✅ ✅
CSS Modules .module.css ✅ ✅
Vue <style scoped> ✅ ✅
Tailwind utilities ⚠️ detected, warns —
Inline styles ❌ —

How it works

Click element
  → overlay reads CSSOM (all matching rules, media queries, container queries)
  → you edit a value → instant visual preview
  → Apply → WebSocket → Vite plugin finds the rule in source → patches file
  → Vite HMR reloads the style → overlay re-reads CSSOM

Try the demo

git clone https://github.com/Artyx71/livestylesync
cd livestylesync
pnpm install
cd apps/demo && pnpm dev

Open http://localhost:5173 — the LSS panel appears in the bottom-right corner.


Roadmap

  • Element picker + highlight
  • CSS / SCSS / CSS Modules / Vue scoped styles
  • Pseudo-state editing (:hover, :focus…)
  • @media responsive editing
  • @container query editing
  • DOM breadcrumb navigation
  • No React peer dependency (Preact bundled)
  • Tailwind utility detection
  • Rollback / undo + session history
  • CSS custom properties editor
  • SCSS $variable editor
  • Create rules for unstyled elements
  • Element search by class / id / selector with highlight
  • Keyboard shortcuts (Alt+S, arrow key nudge)
  • Native color picker for color properties
  • Next.js / webpack support
  • Storybook integration

Contributing

Contributions are welcome. Here's how to get started:

Setup

git clone https://github.com/Artyx71/livestylesync
cd livestylesync
pnpm install

Project structure

packages/
  overlay/        # Browser panel (Preact + TypeScript, bundled with tsup)
  server-core/    # Framework-agnostic WebSocket server + CSS/SCSS patchers
  vite-plugin/    # Vite plugin — thin wrapper around server-core
  nextjs-plugin/  # Next.js webpack plugin — thin wrapper around server-core
  livestylesync/  # Meta-package re-exporting overlay + vite-plugin
apps/
  demo/           # Vite + React demo app for manual testing

Dev workflow

# Run the demo (watches overlay + plugin via pnpm workspaces)
cd apps/demo && pnpm dev

# After changing overlay or plugin source, rebuild:
pnpm --filter livestylesync-overlay build
pnpm --filter livestylesync-server-core build
pnpm --filter livestylesync-vite-plugin build
# Then restart the demo dev server

Run tests

pnpm --filter livestylesync-server-core test

Opening issues

Please use the GitHub issue tracker. When reporting a bug, include:

  • What you did — steps to reproduce
  • What you expected — what should have happened
  • What happened — actual behavior, error messages, screenshots
  • Environment — framework, CSS format (plain CSS / SCSS / Modules / Vue), browser

Feature requests are welcome too — describe the use case, not just the solution.

Pull requests

  • One PR per fix or feature
  • Keep changes focused — avoid unrelated cleanup in the same PR
  • Add a test if you're changing patcher logic (packages/server-core/src/patchers/)
  • Run pnpm tsc --noEmit in the changed package before submitting

License

MIT

About

Edit styles in the browser. Changes go straight to your source files.

Resources

Contributing

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages