lektor-website/content/docs/api/plugins/events/before-build/contents.lr
David Baumgold a98b2fe9f9 Document Python 3 support
Now that Lektor supports Python 3, we need to document this support.
This change is perhaps a bit extreme: it replaces all explicit
references to Python 2.7 with explicit references to Python 3.5.
However, it's a good start, and it can and should be reviewed before
being merged.
2016-06-02 21:55:55 -07:00

36 lines
1.2 KiB
Markdown

title: before-build
---
type: event
---
signature: builder, build_state, source, prog
---
summary: This event is emitted before an individual source is built.
---
body:
This event is emitted right before a source is being built into a final build
artifact. Note that this event in itself does not indicate if the build will
actually take place or not due to the artifact being current already as such
the usefulness is limited.
The parameters being passed are:
* `builder`: a reference to the builder.
* `build_state`: a reference to the build state object.
* `source`: the source object that is being processed. (See
[Source Object :ref](../../../db/obj/) for more information)
* `prog`: the build program that is being used to process the source. (See
[Build Program :ref](../../../build/program/) for more information)
!!!! Note that currently both the builder as well as the build state are
undocumented and unsupported! This means that if a plugin choses to use those
references to do something with it they should consider that they might break
in future versions.
## Example
```python
def on_before_build(self, source, prog, **extra):
print('building %s' % source.source_filename)
```