Skip to content

ScottA38/on-save

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



on-save: Run a shell command when you save a file

Caution

This project is in maintenance mode, and it will not get any new features.

Installation

apm install on-save

Usage

Create an .on-save.json file at the root of your project (or anywhere in the path of the files you want to watch).

For example, if you want to babelify every .js file from src to dist, the .on-save.json file content might be something like:

[
  {
    "srcDir": "src",
    "destDir": "dist",
    "files": "**/*.js",
    "command": "babel ${srcFile} --out-file ${destFile}"
  }
]

Configuration file

The content of the .on-save.json file must be an array of objects with the following properties:

  • srcDir (default to .on-save.json's directory): The source directory.
  • destDir (default to srcDir): The destination directory.
  • files: The files you want to track. You can use a glob (see minimatch), or an array of globs.
  • command: The command to execute. You can use these variables:
    • ${srcFile}: The input file.
    • ${destFile}: The output file.
    • ${destFileWithoutExtension}: The output file without the extension.
  • showOutput (default to false): A boolean indicating whether the output stream (stdout) should be displayed or not.
  • showError (default to true): A boolean indicating whether the error stream (stderr) should be displayed or not.

License

MIT

About

Run a shell command when you save a file in Atom

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%