Skip to content

Instantly share code, notes, and snippets.

@gnat
Last active September 12, 2023 08:35
Show Gist options
  • Save gnat/a6b9fdb8540312381e3e53781e6f8d98 to your computer and use it in GitHub Desktop.
Save gnat/a6b9fdb8540312381e3e53781e6f8d98 to your computer and use it in GitHub Desktop.
Sublime Build on Save

Sublime Build on Save

Sublime in 2023 only has "Save on Build" not "Build on Save" built in.. use: https://github.com/alexnj/SublimeOnSaveBuild

Setting up a build.

  • Tools ➡️ Build System ➡️ New Build System...

run_on_save.sublime-build

{
	"shell_cmd": "python -u $file",
	"file_patterns": ["*.py"],
	"working_dir": "$file.path",
}

CTRL+B... Choose using SHIFT+CTRL+B

Examples

All *.css files into main.css.

{
	"shell_cmd": "cd $folder; find . -type f -name \"*.css\" ! -name \"main.css\" -exec cat {} \\; > main.css",
	"file_patterns": ["*.css"],
}

...same but using your own script.

{
	"shell_cmd": "cd $folder; test -f doit.sh && ./doit.sh css",
	"file_patterns": ["*.css"],
}

Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment