-
Notifications
You must be signed in to change notification settings - Fork 364
6. Commands
The following is a list of all available API commands for Slate Tools:
Builds a production-ready version of the theme by compiling the files into the dist
folder.
slate-tools build
Sets process.env
to ’production’
, which can be used in Slate config to return production only values, e.g.:
// Array of PostCSS plugins which is passed to the Webpack PostCSS Loader
'webpack.postcss.plugins': (config) => {
const plugins = [autoprefixer];
if (process.env.NODE_ENV === 'production') {
plugins.push(cssnano());
}
return plugins;
},
Uploads the dist
folder to the Shopify store.
slate-tools deploy [--env=my-custom-env-name] [--skipPrompts] [--replace]
Flag | Description |
---|---|
--env |
Targets a custom environment file. Setting --env=production would use the .env.production file |
--skipPrompts |
Skips all prompts. This is especially useful when using Slate Tools with continuous integration tools |
--replace |
By default, the deploy command updates any existing files, and adds any new files to your Shopify store's theme. Use this flag to replace all files on your theme with those of your Slate project. This will delete all files from your Shopify theme which are not in your Slate project |
Formats the theme code according to the rules declared in the .eslintrc
and .stylelintrc
files. By default, it uses ESLint Fix to format JS files, Stylelint Fix to format CSS files and Prettier to format JSON files.
slate-tools format [--scripts] [--styles] [--json]
Flag | Description |
---|---|
--scripts |
Runs linting only on script files |
--styles |
Runs linting only on style files |
--locales |
Runs linting only on locales files |
slate-tools lint [--scripts] [--styles] [--locales]
Flag | Description |
---|---|
--scripts |
Runs linting only on script files |
--styles |
Runs linting only on style files |
--json |
Runs linting only on json files |
Compiles your local theme files into a dist
directory, uploads these files to your remote Shopify store and finally boots up a local Express server that will serve most of your CSS and JavaScript.
slate-tools start [--env=my-custom-env-name] [--skipPrompts] [--skipFirstDeploy]
Flag | Description |
---|---|
--env |
Targets a custom environment file. Setting --env=production would use the .env.production file |
--skipPrompts |
Skips all prompts. This is especially useful when using Slate Tools with continuous integration tools |
--skipFirstDeploy |
Skips the file upload sequence and simply boots up the local Express server |
⚠️ Because most of your assets are being served locally, your theme won’t function on any device outside your network. You want to deploy your assets anytime your theme updates are finalized usingslate-tools build && slate-tools deploy
.
Compiles the contents of the dist
directory and creates a ZIP file in the root of the project.
slate-tools zip