Skip to main content
Squeditor allows you to manage multiple visual identities (branding, colors, typography) within a single codebase. This is achieved by mapping specific pages to discrete SCSS theme files and applying scoped CSS variables via a dedicated configuration.

1. The Configuration

Themes are defined in squeditor.config.js. Each theme entry controls how a specific set of pages is styled and packaged.
squeditor.config.js

Property Reference

2. The Theme SCSS File

Each theme SCSS file uses the sq-theme mixin. This mixin automatically generates scoped CSS variables (--sq-*) for both light and dark modes, applied to your theme’s bodyClass.
src/assets/scss/themes/_saas.scss

Advanced Token Customization

Squeditor provides two maps for fine-grained token control:
  1. $overrides: Use this for tokens that should change globally for this theme (e.g., a “rounded” theme where everything has btn-radius: 50rem).
  2. $dark-overrides: Use this for tokens that specifically need adjustment in dark mode. For example, some fonts look thicker on dark backgrounds, so you might want to drop heading-font-weight from 600 (global) to 400 (dark only).

Why use Tokens vs. Manual CSS?

If you update @_base.scss (or the framework defaults) to use tokens:
Then your theme files stay incredibly lean because you’re just changing the data (the variable value), and the framework handles the delivery (scoping it to the right body class and light/dark scheme).

3. How It Works

** Token Override Mechanism ** Squeditor uses a “last-in-wins” approach. During the build process, the framework dynamically rewrites the last @import in your main.scss to target the active theme:
Since the theme file imports last, its CSS variables override all global defaults seamlessly. ** Theme Detection ** The framework identifies the active theme in src/init.php based on:
  1. URL Query: ?theme=id (highest priority)
  2. Page Mapping: Matches the current PHP file against the pages array in your config.
  3. Default: Falls back to the first theme in your config if no match is found.

Demo Mode & Theme Switcher

If $site['demo_mode'] = true is set in your configuration, the Theme Switcher UI will appear. This allows users to manually cycle through your defined palettes and typography presets in the browser, overriding the default theme via query parameters and localStorage.

Playground: Common Scenarios

** Scenario A: Single Niche, Multiple Visual Styles ** Use this when building one template (e.g., a Portfolio) that you want to offer in multiple “flavors” (Clean, Bold, Pastel). All versions share the same pages.
** Scenario B: Multi-Niche with Subdirectories ** Use this when your project contains entirely different niches (e.g., Medical, SaaS, Creative) within a single showcase. Each niche has its own assets and separate distribution output.
In this scenario, the build pipeline generates a clean dist/ structure:
  • dist/medical-demo/index.html (Styled with Medical theme)
  • dist/saas-demo/index.html (Styled with SaaS theme)