# @theme-tools/plugin-shell

> Shell plugin for Theme Tools

Latest version **1.1.0** (published 2018-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @theme-tools/plugin-shell
pnpm add @theme-tools/plugin-shell
yarn add @theme-tools/plugin-shell
bun add @theme-tools/plugin-shell
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-01-09 |
| First published | 2017-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | EvanLovely |
| Maintainers | evanlovely |
| Keywords | theme-tools-plugin, theme-tools |

## Links

- npm: https://www.npmjs.com/package/@theme-tools/plugin-shell
- Repository: https://github.com/basaltinc/theme-tools/tree/master/packages/plugin-shell
- npm.io page: https://npm.io/package/@theme-tools/plugin-shell

## Dependencies (2)

- [gulp](https://npm.io/package/gulp.md) ^4.0.0
- [@theme-tools/core](https://npm.io/package/@theme-tools/core.md) ^1.0.0

## Recent versions

- 1.1.0 (latest) — 2018-01-09
- 1.0.1 — 2017-11-11

## README

# Shell Plugin for Theme Tools

> Watch files and run shell commands - the possibilities are endless!

## Features

- Can make multiple sets of files to watch and shell commands to run
- Registers a `run` task and a `watch` task for each
- Watch tasks trigger OS notification upon errors
- Run tasks exit upon errors

# Getting Started

## Install

```bash
npm install @theme-tools/plugin-shell --save
```

## Setup

Add this to your `gulpfile.js`:

```js
const gulp = require('gulp');
const shell = require('@theme-tools/plugin-shell');

const textTasks = shell({
  watch: ['files/*.txt'],
  cmd: 'echo "a txt file changed"',
  name: 'text',
});
gulp.task(textTasks.run); // registers `gulp text:run` as task
gulp.task(textTasks.watch); // registers `gulp text:watch` as task

const cssTasks = shell({
  watch: ['files/*.css'],
  cmd: 'echo "a css file changed"',
  name: 'css',
});
gulp.task(cssTasks.run); // registers `gulp css:run` as task
gulp.task(cssTasks.watch); // registers `gulp css:watch` as task

gulp.task('run', gulp.series([
  textTasks.run,
  cssTasks.run,
]));

gulp.task('default', gulp.parallel([
  textTasks.watch,
  cssTasks.watch,
]));

```

# Details

## Tasks

These tasks are methods inside `shellTasks` from the above code example. You can run them anyway you can run a function, though they are often ran via Gulp. All tasks take a callback function as the first and only parameter that will run when the task is done - exactly how `gulp.task()`, `gulp.parallel()`, and `gulp.series()` want.

### `.run()` - Run shell

Run the command.

### `.watch()` - Watch and run shell

Watch and run.

## Configuration

**All configuration is deep merged with [`config.default.js`](config.default.js).**

### `cmd`

Type: `String` Default: ``

Shell command to run

### `watch`

Type: `Array<String>` Default: `[]`

Array of file paths to watch. Globs allowed.

### `name`

Type: `String` Default: `shell`

Gulp task name prefix.

### `triggerBrowserReloadAfter`

Type: `Boolean` Default: `false`

If you're using `@theme-tools/plugin-browser-sync`, this command will trigger a reload after.

---
_Source: https://npm.io/package/@theme-tools/plugin-shell · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
