@slater/cli
shopify theme management toolkit
Last updated 8 months ago by estrattonbailey .
MIT · Original npm · Tarball · package.json
$ cnpm install @slater/cli 
SYNC missed versions from official npm registry.

slater

A Shopify theme development toolkit.

Features

  • bare-bones base theme
  • JS and CSS compilation via spaghetti
  • live reloading
  • easy config
  • simple CLI

Install

npm i -g @slater/cli

Getting Started

The easist way to get started with slater is slater init. init outputs a default folder structure into the directory of your choice.

slater init <root>

You'll need to define one or more themes in the provided slater.config.js file to deploy to, similar to a standard Shopify config.yml file.

module.exports = {
  themes: {
    development: {
      id: '12345...',
      password: 'abcde...',
      store: 'store-name.myshopify.com',
      ignore: []
    }
  }
}

Then, from the project root:

slater watch

And that's it! slater will watch your local theme for changes and sync them to your remote site when they update ????.

Configuration

By default, slater looks for a slater.config.js file in the project root. Defaults below:

module.exports = {
  in: '/src',
  out: '/build',
  assets: '/src/scripts/index.js',
  themes: {}
}

Themes

Themes are configured similarly to a standard Shopify config.yml file.

module.exports = {
  themes: {
    development: {
      id: '12345...',
      password: 'abcde...',
      store: 'store-name.myshopify.com',
      ignore: [ 'snippets/test.liquid' ]
    }
  }
}

You can define as many as you like:

module.exports = {
  themes: {
    sandbox: { ... },
    development: { ... },
    production: { ... }
  }
}

And reference each using the --theme flag on the CLI (defaults to development).

slater sync --theme production

Assets

slater uses spaghetti internally to compile JS and CSS, using most goodies you'll want from the Babel and PostCSS ecosystems.

To compile CSS, just import your root stylesheet into your JavaScript index file a la:

import '../main.css'

/* your code here */

Commands

watch

Watches for file changes and syncs updates to your specified theme.

slater watch

build

Compiles assets and copies all files from the config.in directory to the config.out directory.

slater watch

sync

Sync local files or directories to your remote theme. A direct interface to [@slater/sync], which @slater/cli uses internally.

slater sync build/snippets/hero.liquid # file
slater sync build/snippets # directory
slater sync # defaults to config.out

Options

Any of the core commands can be combined with the following options:

  • --config <path> - specify the path to your config file
  • --theme <name> - specify a named theme from your config file

Deployment

To deploy a theme, combine the above commands as needed:

slater build && slater sync --theme production

API

slater can also be used directly in node. The configuration is the same, but instead of themes, simply define a single theme:

// see options above
const config = {
  in: '/theme',
  out: '/dist',
  assets: '/theme/js/index.js',
  theme: {
    id: '',
    password: '',
    store: '',
    ignore: []
  }
}

const app = require('@slater/cli')(config)

Methods

All methods return a Promise.

build

Compile assets.

app.build().then(() => console.log('all done!'))

watch

Watches for file changes and syncs updates to your specified theme.

app.watch()

copy

Copies all files from the config.in directory to the config.out directory.

app.copy()

Live-reloading & HTTPS

slater uses an local SSL certification to correspond with Shopify's HTTPS hosted themes. To take advantage of live-reloading, you need to create a security exception for the slater cert (this is safe). To do this, load https://localhost:3000 in your browser, and following the instructions for adding an exception. If it works, you should see this in your browser window:

@slater/cli successfully connected

License

MIT License © The Couch

Current Tags

  • 0.7.2                                ...           beta (a year ago)
  • 1.1.3                                ...           latest (8 months ago)

48 Versions

  • 1.1.3                                ...           8 months ago
  • 1.0.4                                ...           9 months ago
  • 1.0.3                                ...           10 months ago
  • 1.0.0                                ...           10 months ago
  • 1.0.0-alpha.16                                ...           10 months ago
  • 1.0.0-alpha.15                                ...           10 months ago
  • 1.0.0-alpha.14                                ...           10 months ago
  • 1.0.0-alpha.13                                ...           10 months ago
  • 1.0.0-alpha.12                                ...           10 months ago
  • 1.0.0-alpha.11                                ...           10 months ago
  • 1.0.0-alpha.10                                ...           10 months ago
  • 1.0.0-alpha.9                                ...           10 months ago
  • 1.0.0-alpha.8                                ...           10 months ago
  • 1.0.0-alpha.7                                ...           10 months ago
  • 1.0.0-alpha.6                                ...           10 months ago
  • 1.0.0-alpha.5                                ...           10 months ago
  • 1.0.0-alpha.4                                ...           10 months ago
  • 1.0.0-alpha.3                                ...           10 months ago
  • 1.0.0-alpha.2                                ...           a year ago
  • 1.0.0-alpha.1                                ...           a year ago
  • 0.7.5                                ...           a year ago
  • 0.7.4                                ...           a year ago
  • 0.7.3                                ...           a year ago
  • 0.7.2                                ...           a year ago
  • 0.7.1                                ...           a year ago
  • 0.7.0                                ...           a year ago
  • 0.6.5                                ...           a year ago
  • 0.6.4                                ...           a year ago
  • 0.6.3                                ...           a year ago
  • 0.6.2                                ...           a year ago
  • 0.6.1                                ...           a year ago
  • 0.6.0                                ...           a year ago
  • 0.5.2                                ...           a year ago
  • 0.5.1                                ...           a year ago
  • 0.5.0                                ...           a year ago
  • 0.4.0                                ...           a year ago
  • 0.3.2                                ...           a year ago
  • 0.3.1                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.1                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 48
Last Month 50
Dependencies (23)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |