GithubHelp home page GithubHelp logo

arr4n / save-commands Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jsonhunt/save-commands

0.0 2.0 0.0 49 KB

Assign parametrized shell commands to file globs to be automatically run whenever the file is saved

License: MIT License

CoffeeScript 95.70% CSS 4.30%

save-commands's Introduction

Save-commands package for Atom editor

This package allows you to define parametrized shell commands to be automatically run, in sequence, whenever a file matching glob pattern is saved.
This effectively eliminates the need for file watchers, and simplifies your build process. You can define as many globs and commands as you want. The command(s) and their output will be displayed in a panel at the bottom of the screen. Hit 'Esc' to dismiss the panel.

How to use

Create save-commands.json file in your project's root folder Create one entry for each command you wish to run, and assign it to a glob like this:
glob : command {parameter}

Here is an example of save-commands.json file

{
	"commands": [
		"*.coffee : coffee -c {relFullPath}",
		"src/**/*.coffee : coffee -c -o dist{relPathNoRoot} {relFullPath}",
		"src/**/client/**/*.coffee : gulp browserify",
		"src/client/**/*.jade   : jade -P {relPath}{filename} -o dist{relPathNoRoot}",
		"src/client/**/*.jade   : gulp createTemplateCache",
		"src/server/**/*.jade : copy {relPath}{filename} dist{relPathNoRoot}",
		"src/**/*.styl   : gulp compileStylus",
		"src/**/*-spec.coffee : mocha src{relPathNoRoot}{name}.coffee --compilers coffee:coffee-script/register",
		"src/**/*.coffee : gulp runSpec --file=src{relPathNoRoot}{name}-spec.coffee --require coffee-script/register --compilers coffee:coffee-script/register"
	]
}

You can create multiple save-commands.json files in various folders. The package will navigate file system tree (starting with the folder where saved file is located) until it finds a config file. That folder will also be used as current working directory for commands

If you get errors when saving a file, double check your save-commands.json file to make sure it is formatted properly. As of version 0.6.7, the package will warn you if config file is malformed.

Available parameters:

  • absPath: absolute path of the saved file (without file name)
  • relPath: relative path of the saved file (without file name)
  • relFullPath: like relPath but with filename
  • relPathNoRoot: relative path without top folder
  • filename: file name and extension
  • name: file name without extension
  • ext: file extension
  • sep: os specific path separator

Related packages

Great tool when you are migrating a project from JavaScript to CoffeeScript. Adds an option 'Make me a coffee' to .js files in tree-view.

save-commands's People

Contributors

arr4n avatar jsonhunt avatar magolinks avatar qinming avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.