build is like Makefile for single files.
Instead of having to write a separate Makefile, build reads the build instructions from comments in the file itself. Therefore, you can distribute a file (or gist) by itself without a build script or Makefile.
Add this line to a markdown file:
<!-- @build pandoc -N --toc -o %pdf %md -->or this line to a mscgen file:
# @build mscgen -T png -o images/%png %msc
And then run build onefile.md or build *.md to build multiple files at once.
A comment in the file should contain @build command.
The command can expand %ext to filename.ext automatically.
Note that:
- if the file does not contain a command,
buildattempts to load a default command for the file extension from~/.config/build.defaults buildsucceeds and exits after the run command is found
You can define multiple build types with the following syntax (within files):
@build-{type} command
Then, invoke build with
build -{type} [files]build is written in a single Lua file. To install:
- copy
build.luawhere you want; - create a shell alias so that
buildinvokeslua /path/to/build.lua.
For instance, for:
- bash, run:
alias build=lua /path/to/build.lua - fish, run:
function build
lua /path/to/build.lua $argv
end
funcsave buildbuild is written by Henri Binsztok and licensed under the MIT license.