lektor-website/content/docs/api/build/artifact/replace-with-file/contents.lr

25 lines
679 B
Plaintext
Raw Normal View History

2015-12-19 14:52:17 +01:00
title: replace_with_file
---
summary: Replaces the artifact with a file from the file system.
---
type: method
---
signature: filename, ensure_dir=None, copy=False
---
body:
This method will replace the artifact with another file on the file system
on commit. This is useful when you are dealing with external applications
that create temporaries. By default the file is moved as this is what's
common with temporaries but this can be changed into a copy with `copy=True`.
## Example
```python
ctx = get_ctx()
@ctx.sub_artifact('artifact.txt')
def build_stylesheet(artifact):
temporary_file = invoke_external_program()
artifact.replace_with_file(temporary_file)
```