compile-watch

Watch and compile files with atom

arcath

3,384

5

0.1.4

MIT

GitHub

compile-watch Build Status

The last compiler package you need to install.

Usage

Watch a file and everytime you save it compile-watch will compile it to your desired output location. When you close a file compile-watch will stop watching it. See Project Config for details on how to make compile-watch even faster.

Commands

Project Config

compile-watch looks for a .compile-watch.json file in your projects root which allows you to:

An example config file:

{
  "files": {
    "scss/layout.scss": {
      "output": "css/layout.css",
      "format": "scss"
    },
    "scss/imported.scss": {
      "parent": "scss/layout.scss"
    },
    "coffee/layout.coffee": {
      "output": "js/layout.js",
      "format": "coffee"
    }
  },

  "autowatch": [
    "scss/layout.scss",
    "coffee/layout.coffee"
  ]
}

This config file defined 3 files,

It then declares 2 auto watch files which will be watched automatically when you open them. (These entries must match keys in the files object).

Supported Languages

Adding a Language

All the formats are stored in lib/formats and should be written as there own class.

The Coffee format in lib/formats/coffee.coffee shows an example of compiling a file using an internal library and writing the output to the destination file.

The SASS format in lib/formats/sass.coffee shows an example of running a child process to compile the source file to the destination file.

There is a guide on how to write a compiler here.