Skip to Content
StoreOSv0.31.0
Themes

Code editor

Edit an installed Fluid theme's files in the console, preview the unpublished code privately, publish it as a new version, and go back to an older one.

An installed Fluid theme has code you can change without uploading a new zip. Open Online store → Themes, find the theme and choose Edit code.

The code editor is for Fluid themes only. Themes from the theme catalog have no editable code; change those with the customizer.


How it works

Your store always runs a published version of the theme. A published version never changes.

The editor works on a separate working copy of the files. The first time you open it, the working copy is made from the version your store is using. Saving a file changes the working copy only.

ActionWhat it changes
Save (⌘S / Ctrl+S)One file in the working copy
PreviewNothing on your store. Opens the working copy on your storefront through a private link. It is rebuilt on every save, so reload the preview tab to see your latest save
PublishMakes a new version from the working copy. Your store uses it within about a minute
DiscardPuts the working copy back to the version your store is using

Files

Files sit in the same six folders as an uploaded theme: layout/, widgets/, snippets/, assets/, config/ and locales/. See Theme structure.

The explorer on the left works like the one in VS Code:

  • New File and New Folder are at the top of the explorer and in the right-click menu. They go into the folder you have selected. Typing snippets/cards/price.fluid as a name creates the folder on the way.
  • Right-click a file for Open, Cut, Copy, Paste, Copy Path, Rename and Delete. Right-click a folder for New File, New Folder, Paste, Copy Path and Rename.
  • Drag a file onto another folder to move it.
  • Drop files from your computer onto the explorer to add them. A code file (.fluid, .json, .css, .js, .svg) dropped on a code folder is saved there; images, fonts and anything dropped on assets/ become assets. Dropping a file with the same name replaces it.
  • Right-click a tab to close it, the others, or all of them.

A new folder only exists in the explorer until you put a file in it, and a theme's files must sit under one of the six folders above.

The same rules as an upload apply: file types per folder, at most 500 files, 5 MB per file and 25 MB in total.

If someone else saves the file you have open, your save is refused so you don't overwrite their change. Copy your edits, reload the file and apply them again.


Editor

The editor is the one VS Code is built on, so it works the way you expect: tabs for open files, a minimap, multiple cursors, find and replace (⌘F / Ctrl+F), and the command palette (F1). Each tab keeps its own undo history.

KeysAction
⌘S / Ctrl+SSave the open file
⌘⇧S / Ctrl+Shift+SSave every open file
⌘P / Ctrl+PGo to a file by name
⌘B / Ctrl+BShow or hide the explorer
⌘J / Ctrl+JShow or hide the Problems panel
F2Rename the selected file

It suggests as you type in a .fluid file:

  • Tags after {%: if, for, render, schema and the rest, filled in with their closing tag
  • Filters after |, including the StoreOS ones such as money, asset_url and t
  • Objects inside {{ }}: shop, product, collection, settings and the others, and their fields after a dot
  • This widget's settings after props., read from its own {% schema %}
  • Snippet names inside {% render '…' %} and asset names inside a quoted string
  • Schema keys and field kinds inside {% schema %}
  • Snippets: type widget or schema in the markup for a ready-made block

CSS, JSON and JavaScript files get their usual completions and checks. config/document.json is checked against the document schema as you type.


Problems

Every save runs the theme check on the whole theme and lists every error and warning in the Problems panel (the warning icon at the bottom left, or ⌘J / Ctrl+J). Click a problem to jump to its line. The counts are always in the status bar, and a file with a problem is coloured in the explorer and on its tab. Publish checks once more before it publishes.

Errors stop a publish. Warnings don't. Problems that name a line are also underlined in the editor.

A publish is also stopped when the customizer has placed a widget that the code no longer has. Keep the widget's file, or remove the widget in the customizer first.


Preview

The working copy is built every time you save. Preview opens your storefront with a private link to that build. Only a browser that opened the link sees the unpublished code; shoppers keep seeing the published version. The preview uses the customizer's draft, so unpublished code and unpublished customizer changes show together.

The link stops working after 12 hours. Choose Preview again for a new one. To leave the preview, use Exit in the bar at the top of the page.


History

Every publish is kept as a version, with who published it and the note they wrote. The theme you uploaded is version 1.

  • Use on store makes your store use that version again. The working copy is left as it is.
  • Edit from this loads that version's files into the working copy so you can keep working from it.

The 20 most recent versions are kept, plus the uploaded theme and the version in use.


Tailwind

A stylesheet in assets/ that has @import "tailwindcss"; is compiled on every preview and publish, the same way storeos theme package does it.

A zip made by storeos theme package holds the compiled CSS, not the Tailwind source. A theme that was uploaded as a zip can still be edited, but classes you add to templates don't produce new CSS: write the CSS yourself, or put the Tailwind source back in the stylesheet.

On this page