Skip to Content
StoreOSv0.27.1
CLItheme

theme new

Add a widget or snippet to a StoreOS theme.

Adds a file to the theme in the current folder. An existing file is never overwritten.

Usage

storeos theme new widget <name> [flags]
storeos theme new snippet <name>

name is lowercase letters, numbers and dashes, such as promo-banner.

new widget writes widgets/<name>.fluid with a heading and a text setting to start from, and adds it to a page in config/document.json.

For a built-in widget name such as button, it copies StoreOS's own markup instead. Change the markup and keep the props. Don't add a {% schema %} to it.

new snippet writes snippets/<name>.fluid. Render it with {% render 'name' %}.

Flags

FlagDescription
--page <page>The page to add the widget to: home (default), product, collection, page, blog, blog-post or search. Widgets only

Output

terminal
> storeos theme new widget promo-banner
✓ Created widgets/promo-banner.fluid, added to pages.home in config/document.json
  Edit the markup, and add a setting to "settings" for each props.<name> it uses.

> storeos theme new widget button
✓ Created widgets/button.fluid
  "button" is built in: this markup replaces StoreOS's. Its settings stay the same, so don't add a {% schema %}.

> storeos theme new snippet product-card
✗ snippets/product-card.fluid already exists

Examples

storeos theme new widget promo-banner                 # on the home page
storeos theme new widget size-guide --page product    # on the product page
storeos theme new widget button                       # restyle a built-in widget
storeos theme new snippet product-card

On this page