Multiple commands in Sublime Build System

A little note on the build system integrated in Sublime. If you have multiple commands to execute during a build (for instance minifying your js code, and generating the documentation) your can do it quite easily on Windows, but it took me a while to find the equivalent on Mac, so here is the relevent (simplified version) part of my build system:

"windows": {
    "shell": true,
    "cmd": [
        "python", "build.py", "compress", "&;"
        "python", "build.py", "doc"
    ]
},
"osx": {
    "shell": false,
    "cmd": [
        "sh", "-c", "python build.py compress && python build.py doc"
    ]
}

Notice the difference between Windows and OSX. On Windows, you simply add an additional “&;” parameter which will separate the commands, but on OSX (I guess it would be the same on Linux) it doesn’t work. The only way I found to execute multiple commands was to directly call sh with the -c option and put all my commands in a single string. The commands are then separated by a && sequence.

Oh and also shell must be true on Windows, but false on OSX, else nothing runs.

Leave a Reply

Your email address will not be published. Required fields are marked *